Arduino 2021 Programming User Guide
Arduino 2021 Programming User Guide
PROGRAMMING
USER GUIDE
1
Table of Contents
Introduction to Arduino.................................................. 6
Chapter One ................................................................. 12
What Is the Use of Arduino? ........................................ 12
Arduino Uno Fire Up to Three Improvement Board ... 13
Arduino Uno Wifi Rev 2 Development Board ............ 16
Chapter Two ................................................................. 20
Introduction to Arduino Programming Language ........ 20
Backing for Other Languages ...................................... 24
Arduino Programming Language Built-In Constants .. 25
Arduino Numerical Constants ...................................... 26
The Arduino Programming Language Built-In Functions
...................................................................................... 27
Program Life Cycle ...................................................... 27
Dealing With I/O .......................................................... 27
Analog I/O .................................................................... 29
Time Functions ............................................................ 30
Mathematical Function................................................. 31
Use Alphanumeric Characters...................................... 32
Random Number Generation ....................................... 33
Use Bits and Bytes ....................................................... 34
Interrupts ...................................................................... 35
Chapter Three ............................................................... 36
Milli Micro Nano Pico ................................................. 36
Arduino MKR WiFi 1010 ............................................ 36
3
Form Factor ...................................................................37
Power ............................................................................38
Processor .......................................................................39
Memory .........................................................................40
IoT Connection .............................................................42
Security .........................................................................42
Li-Po Charging Circuit .................................................42
Price ..............................................................................43
Chapter Four .................................................................45
Introduction to Electronics ............................................45
Electronic Basics: Analog and Digital ..........................53
Basic Knowledge of Electronics: Current.....................59
Basic Knowledge of Electronics: Voltage ....................61
Basic Knowledge of Electronics: Vcc, Ground ............62
Basic Knowledge of Electronics: Resistance ................64
Basic Knowledge of Electronics: Short Circuit ............66
Basic Knowledge of Electronics: Your First Circuit ....67
Basic Knowledge of Electronics: Using A Multimeter 85
Chapter Five ..................................................................89
How to Measure Voltage ..............................................89
How to Measure Resistance ..........................................91
How to Measure Current ...............................................94
Using A Multimeter to Measure Voltage, Current, And
Resistance .....................................................................99
How to Measure Voltage ............................................101
4
How to Measure Resistance ....................................... 101
How to Measure Current ............................................ 102
Chapter Six ................................................................. 105
What to Buy to Start Using Arduino And Electronics 105
Arduino Project: Blink A LED .................................. 110
Chapter Seven ............................................................ 122
Arduino Built-In LED ................................................ 122
Breadboard Power Supply Module ............................ 125
Chapter Eight ............................................................. 136
Arduino Creation Platform......................................... 136
Chapter Nine .............................................................. 142
How to Connect to Wifi Network Using Arduino ..... 142
How to Run A Web Server on Arduino ..................... 149
Conclusion ................................................................. 164
5
Copyright 2021 © John .A. Joseph
All rights reserved. This book is copyright and no
part of it may be reproduced, stored or transmitted,
in any form or means, without the prior written
permission of the copyright owner.
Printed in the United States of America
Copyright 2021 © John .A. Joseph
6
Introduction to Arduino
Arduino is a breakthrough technology in the amateur
electronics ecosystem. Breakthrough does not mean
that it introduces a new powerful microprocessor or
something similar. It created an entire industry, a
movement, nothing.
7
historical details, but you can view them for free on
Wikipedia.
9
As it stands, Arduino doesn’t have any operating
system, and it runs one program at a time. You don't
have to worry about anything because there is
nothing else but the program that runs on the
Arduino. Most Arduino development boards don't
even have a network connection. Some people do
this, such as Arduino Uno WiFi Rev 2 or Arduino
MKR WiFi 1010.
10
convenient functions, so that beginners can easily get
started.
11
Chapter One
What Is the Use of Arduino?
First of all, learning electronics is great with Arduino.
12
Arduino Uno Fire Up to Three
Improvement Board
Arduino Uno Rev 3 is a microcontroller board.
14
In the above picture, we can see 14 digital I/O pins on
the top, which can be configured as output pins or
input pins by programming. At the bottom, we have
power pins and six analog input pins.
15
batteries, this will enable it to run until there is
power.
16
It has a similar structure factor as Arduino 101,
Arduino Zero, Arduino Yún, Arduino Leonardo,
Arduino Uno, and Arduino Ethernet.
17
It has a WiFi module that underpins 802.11b/g/n,
specifically NINA-W13, which has an incorporated
TCP/IP convention stack that can give admittance to
WiFi networks dependent on equipment security.
18
Once the program is fully loaded, you can then start
the program, don’t forget to supply power to the
Arduino so as to boost it through USB or via the
AC/DC power cord or you could simply use battery
from the power port. This therefore means that, as
soon as the program is loaded, it can simply be placed
on a mountain along with solar panels and of course
batteries, this will enable it to run until there is
power.
19
Chapter Two
Introduction to Arduino
Programming Language
How Do You Write A Program for The Arduino
Development Board?
20
support Editor and a method to easily compile and
load our Arduino program onto the board connected
to the computer.
21
begun, and the second is called over and over when
the program is running.
22
Your first Arduino program will definitely involve
turning on the LED indicator first and then turning
it off. For this, you will use the pinMode (), delay (),
and digitalWrite () functions, as well as some
constants such as HIGH, LOW, OUTPUT.
#Define LED_PIN 13
void setup () {
Invalid loop () {
digitalWrite(LED_PIN, HIGH);
23
Delay (1000);
digitalWrite(LED_PIN, LOW);
Delay (1000);
24
based on that language Because this is the native and
standardized method of using these devices.
25
Another steady we have is LED_BUILTIN, which
focuses on the pin's quantity on the board, which is
typically equivalent to 13.
26
The Arduino Programming
Language Built-In Functions
This part will give a reference to the implicit
capacities given by the Arduino programming
language.
Digital I/O
27
boundary, and return the HIGH or LOW
consistent.
• digitalWrite () composes the HIGH or LOW
an incentive to the computerized yield pin.
You pass the PIN and HIGH or LOW as
boundaries.
• pinMode () sets the pin as input or output.
You pass the PIN and INPUT or OUTPUT
value as parameters.
• pulseIn () reads the digital pulse from LOW to
HIGH on the pin, and then reads the digital
pulse from LOW, or from HIGH to LOW, and
then reads the digital pulse from HIGH. The
program will block until a pulse is detected.
You can specify the PIN and pulse-type (LHL
or HLH) to be detected. You can specify an
optional timeout period to stop waiting for
the pulse.
• pulseInLong () is the same as pulseIn (), but
the implementation is different, and if the
interrupt is closed, you cannot use it. Usually,
28
turn off interrupts to get more accurate
results.
• shift () reads one byte of data from one pin at
a time.
• shiftout () writes data bytes one byte at a time
to one pin.
• Tone () sends a square wave on the pin for the
buzzer/speaker to play the tone. You can
specify the pin and frequency. It applies to
digital and analog pins.
• noTone () stops the waveform generated by
tone () on the pin.
Analog I/O
• analogRead () reads the value from the analog
pin.
• AnalogReference () configures the value of the
highest input range for analog input. By
default, it is 5V on the 5V board and 3.3V on
the 3.3V board.
29
• AnalogWrite () writes the analog value to the
pin
• AnalogReadResolution() allows you to change
the default analog bit resolution of
analogRead (), which is 10 bits by default. Only
applicable to specific devices (Arduino Due,
Zero, and MKR)
• AnalogWriteResolution () allows you to
change the default analog bit resolution of
analogWrite (), which is 10 bits by default.
Only applicable to specific devices (Arduino
Due, Zero, and MKR)
Time Functions
• delay () specifies the number of milliseconds
for the program to pause as a parameter
• delayMicroseconds () specifies the number of
microseconds for the program to pause as a
parameter
30
• Micros () The quantity of microseconds since
the program started. Reset due to overflow
after about 70 minutes
• millis () The number of milliseconds since the
program was started. Reset due to overflow
after about 50 days
Mathematical Function
• abs () the absolute value of a number
• Constrain () restricts the number to a range;
see usage
• Map () remaps numbers from one range to
another; see usage
• Max () the maximum of two numbers
• Min () the minimum of two numbers
• Pow () the value of the number raised to the
power
• sq () the square of a number
• sqrt () the square root of the number
• cos () the cosine of the angle
• Sin () the sine of the angle
31
• Tangent of a tan () angle
32
• isLowerCase () checks whether the character
is a lowercase letter
• isPrintable () checks whether the character is
a printable ASCII character
• isPunct () checks whether the character is a
punctuation mark (comma, semicolon,
exclamation point, etc.)
• isSpace () checks whether char is a space, form
feed \f, line feed \n, carriage return \r,
horizontal tab \t, or vertical tab \v.
• isUpperCase () checks whether the character
is an uppercase letter
• isWhitespace () checks whether char is a
space character or a horizontal tab \t
33
In Arduino, like in most languages, it is impossible to
get a truly random number, and the sequence is
always the same so that you can use the current time
as the seed for the seed, or (for Arduino) you can read
from the analog port enter.
34
• highByte () Get the high (leftmost) byte of the
word variable (with 2 bytes)
• lowByte () gets the low (rightmost) byte of the
word variable (with 2 bytes)
Interrupts
• noInterrupts () disable interrupts
• interrupts () re-enables after disabling
interrupts
• attachInterrupt () allows digital input pins to
be interrupted. Different boards have
different allowed pins, and please check the
official documentation.
• detachInterrupt () disables interrupts enabled
with attachInterrupt ()
35
Chapter Three
Milli Micro Nano Pico
Through electronic and time measurement, you will
find frequently used terms: nano, micro, nano, pico.
• Milli = 10 ^ -3 = 0,001
• Micro = 10 ^ -6 = 0,000 001
• Nano = 10 ^ -9 = 0,000 000001
• Pico = 10 ^ -12 = 0, 000 000 000 001
36
In this article, I want to give an overview of the
development board and compare it with the Arduino
Uno, which is another Arduino development board I
currently own and the one most commonly used by
beginners.
Form Factor
Let's start with the appearance.
37
Compared with the Arduino Uno development
board, the Arduino MKR WiFi 1010 is much smaller.
More than two times smaller.
Power
Arduino MKR WiFi 1010 can be powered by 5V input
or a Micro-USB connector.
38
Its working voltage is 3.3V. This is a very important
difference from the Arduino Uno, which works at 5V.
The maximum voltage that the I/O pins can support
is 3.3V.
Processor
The Arduino MKR WiFi 1010 development board is
equipped with a low-power SAMD21 Cortex-M0 + 32-
bit ARM processor.
39
Memory
The development board has 256KB flash memory and
32KB SRAM.
I/O Pins
41
The complete pin diagram can be found here.
IoT Connection
Arduino MKR WiFi 1010 provides a WiFi module,
namely WiFi U-BLOX NINA-W10 series low power
2.4GHz. It supports 802.11 b/g/n protocol and also
provides Bluetooth Low Energy (BLE).
Security
The evaluation board has an encryption chip, which
can realize the SHA-256 secure connection, namely
ATECC508.
42
When the USB power is disconnected, the device will
automatically switch to an external battery.
Price
In terms of price, Arduino MKR WiFi 1010 is more
expensive than Arduino Uno Rev3 board but cheaper
than Arduino Uno WiFi Rev2.
43
Therefore, we can say that the Arduino MKR WiFi
1010 is 9 euros cheaper than its Uno IoT counterpart,
the Arduino Uno WiFi rev2, which can be considered
as its educational version.
44
Chapter Four
Introduction to Electronics
This is a region that I am exceptionally enthusiastic
about, and I trust it resembles programming. We
change contributions to yields and make valuable
frameworks by joining straightforward segments into
more perplexing designs.
45
• Arduino Uno version 3
• Arduino Uno WiFi version 2
• Arduino MKR WiFi 1010
47
This skill can bring you a high salary, but it can also
make you very satisfied with DIY and handicrafts.
48
• Vcc, ground
• Resistance
• Short circuit
• Your first circuit
• Use breadboard to make prototypes
• Use a multimeter to quantify resistance,
current, and voltage
• Resistance
• Light Emitting Diode (LED)
• Diode
• Button
• Potentiometer
• Capacitor
• Inductor
• Relay
• Transformers
• Transistor
• Thyristor
• 7-segment display
49
• LED display
• switch
• LCD Monitor
• Photodiode
• Buzzer and speaker
• Thermistor
• Thermocouple
• Tilt sensor
• Accelerometer
• Force sensor
• Vibration sensor
• Humidity Sensor
• Sound sensor
• Photoresistance
• Photoresistance
• Phototransistor
• Magnetic sensor
50
• Proximity sensor
• Microphone
• Keyboard
• Servo motor
• Stepper motor
We will learn:
• Binary arithmetic
• Boolean algebra
• Logic Gate
• Combinational logic
• Use integrated circuits
• Multiplexer and demultiplexer
51
• Encoder
• Flip flops
• Arithmetic logic unit
• Clock generator
• Counter
• Register
• Memories
52
to advanced level. We will work on very good projects
that use it.
53
Using only 0 and 1 values to represent basic values
can simply solve complex problems and ultimately
led us to create things such as computers,
smartphones, and the Internet.
54
You can delete or add the leading zeros in the
numbers because they do not mean that anything in
the upper left corner 1:1:1 can represent 0110 or
00000110 (if needed). It has the same exact meaning
because, as explained by the system above, we only
need to multiply the power of 2 by zero.
55
Decimal number Binary number
0 00
1 01
2 10
3 11
0 000
1 001
56
2 010
3 011
4 100
5 101
6 110
7 111
57
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
58
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
59
We have two kinds of electric current: alternating
current (AC) and direct current (DC) In direct
current (DC), current flows in one direction, which is
the current type produced by a battery.
60
Basic Knowledge of Electronics:
Voltage
What is voltage?
61
Voltage is a relative measure. It measures the
potential difference between two points. So, say 5V,
which is relative to the ground.
62
Especially worth mentioning are -0V, battery
negative, ground, GND, and Vss.
63
Basic Knowledge of Electronics:
Resistance
If the + and-poles of the battery are connected to
each other, too much current will flow, and the
battery will be damaged. The current is too large to
handle. We need to introduce the concept of
resistance, that is, the limitation of current.
1Ω = 1 V / 1 A
64
From this we can draw:
• V=R*I
• I=V/R
65
Basic Knowledge of Electronics:
Short Circuit
In an electronic system, we can make different
components perform different tasks and combine
them to form a circuit.
66
can cause a fire (I don't recommend trying, but it is a
cool ignition method when you forget the lighter in
camping.).
67
Tinkercad from Autodesk, the creator of the famous
AutoCAD, allows you not only to create and simulate
electronic circuits but also to create and simulate
electronic circuits and create 3D printing designs.
This is a very cool web application.
68
Click the Create New Circuit button, and you will see
the circuit builder interface:
69
Now you can drag and drop components in the right
sidebar of the main screen.
70
Drag the negative pole to one of the resistors:
71
Now, connect the resistor to the cathode called the
LED on the left. The cathode is straight.
72
You can change the settings of each component with
a single click. For example, click on a resistor to find
out and change its resistance value, which is 1kΩ by
default:
73
Double-click the wire to add a point on it so that you
can make a better circuit:
74
After sorting it out, the results are as follows:
75
Now, click the "Start Simulation" button. Before
clicking "Stop Simulation", you will see the LED light
up:
76
Run the simulation again, you will see a warning on
the LED, informing you that the current flowing
through is too large, and the recommended
maximum current that the LED can handle is 20mA:
77
It's possible to change the value of the resistor while
the simulation is running. If you write 1000Ω instead
of 220Ω, you will see a decrease in the LED's
brightness.
Add 10000Ω, and the LED will now display all light.
78
Remember Ohm's law, I = V / R: The current flowing
through the circuit using a 220Ω resistor is 9/220 =
40mA.
79
The elements are displayed in a small white box
called a breadboard:
80
The breadboard has 17 groups of 5 interconnected
elements on one side and 17 groups of interconnected
elements on the other side.
81
The principle is the same; we have more elements on
the outer boundary, these elements are wrapped in
red and blue lines:
82
In this case, these items are longitudinally
orthogonally connected to the five-element groups
inside the board:
83
Usually, you use a breadboard to make a circuit
prototype:
84
Once you are set to move on, you can solder it to the
perforated board.
85
Unless you don't need a very professional service, you
can buy a great product for less than $30.
86
You can also see that one has a 10A port, and the
other has a 20A port. This means that one person can
measure up to 20 amps before disconnecting the fuse,
and the other half can measure.
87
The digital multimeter can measure voltage
(voltmeter), current (amperemeter), resistance
(ohmmeter), capacity, frequency, etc.
88
Chapter Five
How to Measure Voltage
Let's start measuring the voltage. Take the battery,
connect and select the V symbol:
89
90
How to Measure Resistance
Now, let us see how to measure resistance.
91
If it's not too much trouble, note that already we
didn't need to set the scale. It was resolved
consequently. Here, if the opposition is excessively
low or excessively high for the scale, you need to
change between 200 2000 20k 200k 2000k to see
which one can bring you significant outcomes.
92
For instance, here, I picked a size of 20k, and it is
shown as 0.22. 20k means it can quantify protections
up to 20kω. For this situation, 0.22 means 0.22 of 1kω:
93
How to Measure Current
I told you the best way to gauge voltage and
opposition first since they work correspondingly: the
connector is put corresponding to the thing we need
to quantify.
94
To measure the current, we build a small circuit. In
this case, I have a potentiometer to light up the LED.
95
Two links associate the LED cathode to the lead that
shuts the circuit to GND. This is significant: don't
quantify the current moving through the component
by interfacing the multimeter straightforwardly to its
link. It's necessary to make the multimeter part of the
circuit.
96
The multimeter goes about as a wire.
97
You get 753uA, which is equal to 0.753mA.
98
A Multimeter Tool Can be used to
take the Measure Voltage, Current,
And Resistance
A digital multimeter is a convenient tool, one of the
few tools you need to use to get started.
99
Unless you don't need a very professional service, you
can buy a great product for less than $30.
You can also see that one has a 10A port, and the
other has a 20A port. This means that one person can
measure up to 20 amps before disconnecting the fuse,
and the other half can measure.
100
How to Measure Voltage
Let's start measuring the voltage. Take the battery,
connect and select the V symbol:
101
points to see which one can bring you meaningful
results.
102
use input #4 to measure volts and Ω, but use input #1
(and a lot of current through input #2) to measure
current:
103
are the same as the ports we used for voltage and
resistance:
104
Chapter Six
What to Buy to Start Using Arduino
And Electronics
In my e-tutorial series, I did use a set of tools that I
purchased after a while.
106
It contains many things: breadboards, many wires,
resistors, LEDs, batteries, shields, power modules,
water level sensors, keyboards, LCD screens, buttons,
joysticks, stepper motors, servo motors, infrared
receivers and transmitters, relays, Ultrasonic sensors,
and so on.
There are other similar kits, but please make sure the
development board is Arduino Uno. This is the best
place to start.
109
Arduino Project: Blink A LED
I acquainted Arduino in Introduction with Arduino.
110
This is the board:
111
We have a bunch of force pins and simple I/O pins
on one side:
112
There is also a set of digital I/O pins on the other side:
113
+ And-are connected to the Arduino power pins for
5V and GND:
114
As you can see, when we use the battery to power the
Arduino, the LED will light up:
115
Subsequent to downloading the product, you need to
move the Arduino application to the macOS's
Applications organizer. Check Windows and Linux
establishment directions.
116
As referenced in the Arduino programming language
instructional exercise presentation, the
arrangement(,) work is executed once following the
program begins. For instance, we normally set the
pin mode here. The circle () work is constantly
executed persistently on the up and up.
118
Ensure the Arduino is associated with the PC.
119
On the off chance that you separate the USB link
from the PC, you will see the LED goes off in light of
the fact that the Arduino is done providing power.
120
When the program is controlled, it will begin and
run.
121
Chapter Seven
Arduino Built-In LED
The Arduino development board comes with a small
utility: built-in LED.
122
This LED is connected to digital I/O pin #13 on most
boards. On some boards, such as the Arduino MKR
series, it is linked to pin 6.
124
Breadboard Power Supply Module
I connected the circuit to a 9V battery in some of my
electronic tutorials because it is easy to get started
and easy to find.
But this is not the best choice. The first is because the
battery will deplete over time and cannot provide the
nominal 9V.
125
126
127
The accepted input voltage is 6.5V-9V DC. The
maximum output current is 700mA.
128
129
Then, you can independently determine the tension
to be applied to the breadboard power cord on each
side: 5V, in this case:
130
Or 3.3V, by changing the position of the jumper:
131
You can also close it by placing the jumper in the
middle:
132
Press the gray button to turn it on. The LED will also
light up:
133
The USB port does not exist and cannot supply power
to the power module. You can power USB devices
(such as Arduino) when needed.
134
135
Chapter Eight
Arduino Creation Platform
Arduino Create is a cloud editor that allows you to
write and compile code directly in the browser.
137
At the top, you could see that it has recognized the
Arduino Uno connected to the USB port (the line
/dev/cu.usbmodem14301 represents the USB port). It
will automatically recognize the Arduino
development board.
138
The "Examples" menu lists many pre-made examples,
including source code, instructions, and circuit
schematics and pictures in some cases:
140
Next, you will get inline help, which provides some
tutorials, feature preferences, and usage quotas, such
as storage compilation time and several projects.
141
Chapter Nine
How to Connect to Wifi Network
Using Arduino
When you connect electronic devices built with
Arduino to the network, they become very cool.
#include <SPI.h>
#include <WiFiNINA.h>
142
The WiFiNINA library uses the SPI library, so it must
also be loaded. SPI stands for Serial Peripheral
Interface. The WiFiNINA library allows us to access
the WiFi objects that will be used.
Serial.begin(9600);
143
while(!Serial);
Serial.print("Connecting");
Serial.println(ssid);
delay (2000);}
144
Serial.print("IP address:");
Serial.println(WiFi.localIP());
#include <SPI.h>
#include <WiFiNINA.h>
void setup () {
Serial.begin(9600);
while (! Serial);
Serial.print("Connecting");
Serial.println(ssid);
145
Status = WiFi.begin(ssid, pass);
Delay (5000);}
Serial.print("IP address:");
Invalid loop () {}
Serial.print(WiFi.RSSI());
If (WiFi.firmwareVersion()
<WIFI_FIRMWARE_LATEST_VERSION) {
146
Serial.println("Firmware Upgrade Available");}
148
How to Run A Web Server on
Arduino
This tutorial will show you how to start a web server
on an Arduino device with WiFi, such as my Arduino
MKR WiFi 1010.
149
This is very interesting for various applications, from
simply checking sensor data to performing
operations based on executed HTTP requests.
#include <SPI.h>
#include <WiFiNINA.h>
Serial.begin(9600);
while (! Serial);
Serial.print("Connecting");
150
Serial.println(ssid);
Delay (5000);}
Serial.print("IP address:");
Serial.println(WiFi.localIP());}
Invalid loop () {}
server.begin();
151
an HTTP worker without help from anyone else
without much of a stretch.
Invalid loop () {
If (customer) {}}
152
• Call client. read () to read a byte from the
incoming data (HTTP request sent by the
client)
• Call client. printing () or client.print () to send
data to the client to establish an appropriate
HTTP response
• Call client. stop() to end the connection
Invalid loop () {
Serial.write(c);}} client.stop();}}
153
GET / HTTP / 1.1
Host: 192.168.1.40
Connection: keep-alive
Note the blank line at the end. This is the end of the
HTTP request.
154
Therefore, the end of the request can be determined
by two sequences: \r\n\r\n.
Invalid loop () {
If (customer) {
char prevprev;
Character prev;
And (client.connected()) {
If (client.available()) {
Character c = client.read();
Serial.write(c);
155
If (prevprev =='\ n'&& prev =='\ r'&& c =='\ n') {
<html>
test
</ html>
such:
156
client.println("HTTP / 1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection:close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("test");
client.println("</html>");
rest;
#include <SPI.h>
#include <WiFiNINA.h>
157
WiFiServer server (80);
void setup () {
Serial.begin(9600);
while (! Serial);
Serial.print("Connecting");
Serial.println(ssid);
Delay (5000);}
Serial.print("IP address:");
Serial.println(WiFi.localIP());
158
server.begin();}
If (customer) {
char prevprev;
Character prev;
And (client.connected()) {
If (client.available()) {
Character c = client.read();
Serial.write(c);
client.println("Content-Type: text/html");
client.println("Connection:close");
client.println();
159
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("test");
rest;}
Try it, and you should see the test display in your
browser:
160
This method is effective until you need to figure out
how customers ask us.
Invalid loop () {
161
If (customer) {
String line="";
And (client.connected()) {
If (client.available()) {
Character c = client.read();
Serial.write(c);
Line + = c;}
If (c =='\n') {
If(line.length() == 0) {
client.println("Content-Type: text/html");
client.println("Connection:close");
client.println();
162
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("test");
rest;
} Other {
line = "";
client.stop();
163
Finally, since the line has been terminated, we can
check the line and take corresponding measures
according to our needs.
Conclusion
when you completely adhere to all the instructions
provided, there is no doubt, success awaits you in
your journey to Arduino Programming.
164