Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to include the WiFi library for ESP8266.
Arduino
#include <[1]>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including the generic WiFi library instead of the ESP8266 specific one.
Using ESP32 library for ESP8266.
✗ Incorrect
The ESP8266 requires the ESP8266WiFi.h library to manage WiFi connections.
2fill in blank
mediumComplete the code to connect to a WiFi network using SSID and password.
Arduino
WiFi.begin([1], password); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without quotes.
Using the password instead of SSID.
✗ Incorrect
The SSID must be a string literal enclosed in double quotes.
3fill in blank
hardFix the error in the code to check if WiFi is connected.
Arduino
if (WiFi.[1]() == WL_CONNECTED) {
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connect' or 'begin' which start connections, not check status.
Using 'isConnected' which does not exist.
✗ Incorrect
The correct function to check WiFi connection status is status().
4fill in blank
hardFill both blanks to print the local IP address after connecting to WiFi.
Arduino
Serial.println(WiFi.[1]()); Serial.print("IP Address: "); Serial.println(WiFi.[2]());
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'macAddress' or 'SSID' instead of 'localIP'.
Not checking connection status before printing IP.
✗ Incorrect
First, check connection status with status(). Then get the IP with localIP().
5fill in blank
hardFill all three blanks to create a WiFi access point with SSID and password, then print its IP.
Arduino
WiFi.softAP([1], [2]); Serial.print("AP IP: "); Serial.println(WiFi.[3]());
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localIP' instead of 'softAPIP' for access point IP.
Not using quotes around SSID and password.
✗ Incorrect
Use softAP with SSID and password strings, then get the access point IP with softAPIP().