![]() ![]()
MDNSResponder mdns // Create aREST instance We can then create the CC3000 instance, server and aREST instance −Īdafruit_CC3000_Server restServer(LISTEN_PORT) // DNS responder instance The port to listen for incoming TCP connections #define WLAN_SECURITY WLAN_SEC_WPA2 // This can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, ![]() #define WLAN_SSID "yourNetwork" // cannot be longer than 32 characters! WiFi network (change with your settings!) Wi-Fi name and password, and the port for TCP communications (we have used 80 here). #Arduino manager wificc3000 example code#You need to define inside the code what is specific to your configuration, i.e. The goal here is to connect to your WiFi network, create a web server, check if there are incoming TCP connections, and then change the state of the relay accordingly. #Arduino manager wificc3000 example how to#We will first take care of Arduino sketch, and then we will see how to write the server-side code and create a nice interface.įirst, the Arduino sketch. However, for this project, Arduino board will be running a small web server, so we can “listen” for commands coming from the computer. #Arduino manager wificc3000 example software#The software for this project is based on the TCP protocol. Let us now control the relay wirelessly using the CC3000 WiFi chip. You can just upload it to the board and the relay will switch states every second, and the LED will switch ON and OFF accordingly. You can test the relay with the following sketch − You also have to place the rectifier diode (anode connected to the ground pin) over the pins of the coil to protect your circuit when the relay is switching.Ĭonnect the +5V of Arduino board to the common pin of the relay’s switch.įinally, connect one of the other pin of the switch (usually, the one which is not connected when the relay is off) to the LED in series with the 220 Ohm resistor, and connect the other side of the LED to the ground of Arduino board.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |