Turning the light on and connecting it to the cloud (image/code below):
This code controls a light where the light is connected and assigned to pin D3. The setup function configures the pin as an output and registers a cloud function "led" for remote control. The "ledControl" function enables the light to be turned on or off based on the commands provided. Returning -1 for invalid commands and 1 for successful commands. Physically, I aligned the resistor to the D3 pin and placed the anode side of the LED to align to the resistor, which will incorporate the LED to the D3 pin on the microcontroller. The LED cathode then utilizes a jumper to the breadboard's power rail. A similar jumper is also used to connect the microcontroller's ground pin to the power rail.
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .