Bluetooth Night Light
Language | English |
---|
目录PurposeWhen ambient light becomes dark, the night light turns on automatically. Using Bluetooth to access the light, you can control the color. PrincipleEquipment
DocumentAndroid Clinet: Note: The new 4.0 version BT needs to be supported by Android version 4.3 and higher. Here we offer Android APP. APP download:'文件:Microduino-LAMP-APP.zip Hardware Buildup
Software Debugging
Code description:
The use of BT serial port needs to be choosed accoding to wire jumpers oon the board. The default serial port is 0:Serial. “ble()”function is for Bluetooth recieving data and lantern controlling.
#define Light 100
ightValue = analogRead(Light_PIN);
if (!color_en && lightValue < Light)
{
rainbowCycle(10, 255, 0, 0, 0);
rainbowCycle(10, 255, 0, 0, 1);
rainbowCycle(10, 0, 255, 0, 0);
rainbowCycle(10, 0, 255, 0, 1);
rainbowCycle(10, 0, 0, 255, 0);
rainbowCycle(10, 0, 0, 255, 1);
rainbowCycle(10, 255, 0, 225, 0);
rainbowCycle(10, 255, 0, 225, 1);
rainbowCycle(10, 247, 139, 5, 0);
rainbowCycle(10, 247, 139, 5, 1);
rainbowCycle(10, 255, 255, 0, 0);
rainbowCycle(10, 255, 255, 0, 1);
rainbowCycle(10, 0, 255, 255, 0);
rainbowCycle(10, 0, 255, 255, 1);
for (int i = 0; i < 3; i++)
rainbow(30);
}
else if (!color_en)
colorSet(strip.Color(0, 0, 0));
ResultWhen there is Bluetooth connection, the lantern is controlled via the Bluetooth. While no Bluetooth connection, the lantern will go on when the ambient light brightness is less than the pre-set light value otherwise, it will go off. You can use LEGO to stack with our mCookie sensor to build a beautiful frame. Video |