Arduino

0.0(0)
studied byStudied by 0 people
0.0(0)
linked notesView linked note
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
full-widthPodcast
1
Card Sorting

1/25

flashcard set

Earn XP

Description and Tags

The functions of Arduino what each does in a program

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

26 Terms

1
New cards

What does this code do?

Turns an Arduino with an ESP8266 WiFi shield into a simple web server that displays "Hello World!"

2
New cards

include "WiFiEsp.h" What does this line do?

Includes the main library needed to control the ESP8266 WiFi module.

3
New cards

include "SoftwareSerial.h" What does this line do?

Includes the library that allows the Arduino to create a "virtual" serial port on digital pins.

4
New cards

SoftwareSerial softserial(4, 5); What does this line do?

Creates a new software serial port, telling the Arduino that pin 4 is for Receiving (RX) and pin 5 is for Transmitting (TX).

5
New cards

char ssid[] = "…"; What is this variable for?

Stores the name (SSID) of your WiFi network.

6
New cards

char pass[] = "…"; What is this variable for?

Stores the password for your WiFi network.

7
New cards

WiFiEspServer server(80); What does this line do?

Creates a web server object that will listen on port 80.

8
New cards

Port 80 What is special about Port 80?

It is the standard, default port for HTTP (web) traffic.

9
New cards

setup() What is the purpose of the setup() function?

It's a function that runs only once when the Arduino first powers on to initialize everything.

10
New cards

Serial.begin(9600); What does this command do?

Initializes the main serial port for communication with the computer's Serial Monitor at 9600 baud.

11
New cards

softserial.begin(9600); What does this command do?

Initializes the software serial port for communication with the WiFi shield at 9600 baud.

12
New cards

WiFi.init(&softserial); What does this command do?

Tells the WiFiEsp library to use the softserial port to talk to the WiFi shield.

13
New cards

WiFi.begin(ssid, pass); What does this command do?

Attempts to connect the Arduino to the WiFi network using the stored SSID and password.

14
New cards

server.begin(); What does this command do?

Starts the web server, telling it to begin listening for incoming connections.

15
New cards

loop() What is the purpose of the loop() function?

It's a function that runs over and over forever after setup() is complete.

16
New cards

WiFiEspClient client = server.available(); What does server.available() do?

Checks if a new client (like a web browser) has tried to connect. If yes, it returns a client object.

17
New cards

if (client) What does this line check?

Checks if a new client has successfully connected to the server.

18
New cards

client.read() What does this function do?

Reads one character of data (part of the HTTP request) sent from the web browser.

19
New cards

HTTP/1.1 200 OK What is this?

A standard HTTP response header sent from the server to the browser, meaning "the request was successful."

20
New cards

Content-Type: text/html What does this HTTP header tell the browser?

That the data being sent next is an HTML webpage.

21
New cards

Refresh: 20 What does this HTTP header tell the browser?

To automatically reload the page every 20 seconds.

22
New cards

client.print() What is this command used for in the loop?

To send data (the HTML webpage) back to the client's web browser.

23
New cards

++reqCount What does this expression do?

Increments the reqCount variable by one and then uses its new value.

24
New cards

client.stop() What does this command do?

Closes the connection to the web client after the full response has been sent.

25
New cards

printWifiStatus() What is the purpose of this custom function?

To print the Arduino's network name (SSID) and its local IP address to the Serial Monitor.

26
New cards

WiFi.localIP() What does this function return?

The IP address that the WiFi network assigned to the Arduino (e.g., 192.168.1.120).