HTTP - Set up Server to Control LED
Materials
AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1
Breadboard x 1
LED x 1
1KΩ Resistor x 1
Example
In this example, by connecting Ameba to WiFi and using Ameba as a server, the user can control the LED through a webpage.
In a LED, the longer pin is the positive pole, and the shorter pin is the negative pole. So, we connect the shorter pin to GND and connect the longer pin to D13. Additionally, to avoid the electric current exceeding the tolerance of the LED and causing damage, we connect a resistor to the positive pole.
Then open “File” -> “Examples” -> “WiFi” -> “SimpleWebServerWiFi”
Upload the code and press the reset button on Ameba. When the connection is established, you will see the message “To see this page in action, open a browser to http://xxx.xxx.xxx.xxx” in the Arduino IDE, as shown in the figure:
Next, open the browser of a computer or a cell phone under the same WiFi domain, enter the address in the message.
In the webpage, you can turn on/off the LED.