WiFi - Set up Client to Retrieve Google Search Informations
AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1
In this example, we use Ameba to be a web client to retrieve Informations from the Internet.
First, make sure the correct Ameba development board is selected in “Tools” → “Board”
“File” → “Examples” → “WiFi” → “WiFiWebClient”
In the sample code, modify the highlighted snippet and enter the required Informations (ssid, password, key index) required to connect to your WiFi network.
Upload the code and press the reset button on Ameba. Then you can see the Informations retrieved from Google is shown in the Arduino serial monitor.
To get the Informations of a WiFi connection: Use
WiFi.SSID()to get SSID of the current connected network.
WiFi.RSSI()to get the signal strength of the connection.
WiFi.localIP()to get the IP address of Ameba.
WiFiClient()to create a client.
client.connect()to connect to the IP address and port specified.
client.println()to print data followed by a carriage return and newline.
client.available()to return the number of bytes available for reading.
client.read()to read the next byte received from the server the client is connected to.
client.stop()to disconnect from the server the client is connected to.