Devices & Components
Arduino Nano 33 BLE with headers
Box 525 1% precision resistors - 17 values
Breadboard - 400 contacts
RGB LED Common Cathode
Breadboard Jumper Wire Pack (200mm&100mm)
Photoresistor 2-200 kΩ
Hardware & Tools
Flashlight
Software & Tools
Custom Robot Control
Arduino IDE
Project description
Code
Code
cpp
Requires the Custom Robot Control library.
1#include <Custom_Robot_Control.h> 2 3// Input/Output Pins 4#define RED 2 5#define GREEN 6 6#define BLUE 7 7#define PHOTORESISTOR A0 8 9// Custom Robot Control Array Indexes 10#define RED_INDEX 0 11#define GREEN_INDEX 1 12#define BLUE_INDEX 2 13#define PHOTORESISTOR_INDEX 3 14 15Custom_Robot_Control controller; 16 17void setup() { 18 pinMode(RED, OUTPUT); 19 pinMode(GREEN, OUTPUT); 20 pinMode(BLUE, OUTPUT); 21 pinMode(PHOTORESISTOR, INPUT); 22 23 // Start the Bluetooth® Low Energy controller 24 controller.begin(); 25} 26 27void loop() { 28 // Must be called as often as possible; does essential background work 29 controller.loop(); 30 31 // Only updates values if the app is connected 32 if(controller.isConnected()){ 33 // Pass Bluetooth values to the output pins. 34 analogWrite(RED, controller.read(RED_INDEX)); 35 analogWrite(GREEN, controller.read(GREEN_INDEX)); 36 analogWrite(BLUE, controller.read(BLUE_INDEX)); 37 38 // Send the sensor value 39 controller.write(PHOTORESISTOR_INDEX, analogRead(PHOTORESISTOR)); 40 } 41}
Documentation
Custom Robot Control User Manual
Explains how to use the Custom Robot Control app.
https://musician-app-pro.web.app/manual.pdf
Comments
Only logged in users can leave comments