Remotely control an LED with ease.
Devices and components
Arduino Nano 33 BLE with headers
Box 525 Resistors precision 1% - 17 values
Breadboard - 400 contacts
Common cathode RGB LED
Breadboard Jumper Wire Pack (200mm & 100mm)
Photoresistor 2-200 kΩ
Materials and tools
Flashlight
Software and tools
Custom robot control
Arduino IDE
Project description
Introduction
Build the circuit
Connect the app
Table index: 0
Minimum value: 0
Maximum value: 255
Table index: 1
Minimum value: 0
Maximum value: 255
Table index: 2
Minimum value: 0
Maximum value: 255
Table index: 3
Minimum value: 0
Maximum value: 1024
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 application.
https://musician-app-pro.web.app/manual.pdf
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.