Arduino and Genuino 101 Development Workshop - Agus Kurniawan Part 019
Arduino and Genuino 101 Development Workshop - Agus Kurniawan Part 019
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
void loop() {
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// do nothing forevermore:
while (true);
}
}
Change value of ip for Arduino. In this code, I don’t use DHCP server so I remark codes
for DHCP case which I set static IP Address.
Save the program as WebClient.
10.3.2 Testing
Now you can compile and upload the program into Arduino board. Then, open Serial
Monitor to see the program output. Press Reset button on Arduino board to reset your
board.
A sample of program output is shown in Figure below.