Hardware Reference
In-Depth Information
However, it can be that the mDNS server is not working on your computer. I invite you to
check the page of the CC3000 mDNS library for more details. If your computer is not
compatible, you will have to know the exact IP address of the CC3000 board. This is done
with the following function that will print the IP address whenever the board starts:
while (! displayConnectionDetails()) {
delay(1000); }
Before the end of the setup, we still need to start our server running on the Arduino board.
This is done with the following piece of code:
restServer.begin();
Serial.println(F("Listening for connections..."));
Now, in the loop() function of the sketch, we first have to update the mDNS service:
mdns.update();
And finally, check if any client wants to connect to the Arduino web server, and handle
this client using the aREST library if that's the case:
Adafruit_CC3000_ClientRef client = restServer.available();
rest.handle(client);
And thanks to the aREST library, that's all we have to do! You can now upload the code to
the board (make sure that you changed the code with your own SSID and password).
When that's done, open the serial monitor, wait for a few seconds, and you should see the
following output at the end:
Listening for connections...
If you can see this message, it means your board is connected to the Wi-Fi network. You
should also see the IP address of the board being printed. Write it down, you might need it
soon.
You can now close the serial monitor and open your favorite web browser. What we will
do first is set the relay pins as outputs, starting with pin number 6. Just type the following
command in the URL field of your browser:
http://arduino.local/mode/6/o
Search WWH ::




Custom Search