Realtek Ameba RTL8195 Technical Workshop pdf pdf

  Realtek Ameba RTL8195 Technical Workshop

  Realtek Ameba RTL8195 Technical Workshop Agus Kurniawan 1st Edition, 2018 Copyright © 2018 Agus Kurniawan

  Table of Contents

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

Preface

  This book was written to help anyone want to get started with Realtek Ameba RTL8195 board development. It describes the basic elements of Realtek Ameba RTL8195 development using Arduino and Mbed software.

  Agus Kurniawan Depok, July 2018

1. Preparing Development Environment

1.1 Realtek Ameba RTL8195

  Realtek Ameba RTL8195 is development board from Realtek. This board provides an IoT solution inside the familiar Arduino form factor. The Ameba Board supports WiFi, GPIO, NFC, I2C, UART, SPI, PWM and ADC operations, and can support Ethernet via Arduino-compatible headers, providing you a great IoT platform for your next project.

  The following is a list of forms of Realtek Ameba RTL8195 board.

  The following is the board specification: 32-bit ARM Cortex M3 (166MHz)

  Officially you can buy this board on You also can buy this product on your local electronic store.

1.2 Electronics Components

  We need electronic components to build our testing, for instance, Resistor, LED, sensor devices and etc. I recommend you can buy electronic component kit. We can use electronics kit from Arduino to be developed on Realtek Ameba RTL8195. The following is a list of electronics kit which can be used in our case.

1.2.1 Arduino Starter Kit

  Store website:

1.2.4 Arduino Sidekick Basic kit v2

  Store website:

  1.2.5 Grove - Starter Kit for Arduino

  

  1.2.6 DFRobot - Arduino Kit for Beginner v3

1.3 Development Tools

  To develop app with Realtek Ameba RTL8195 board, I use Arduino IDE for text editor. You can learn how to install it on chapter 2.

1.4 Unboxing

  I bought Realtek Ameba RTL8195 from Seeedstudion. The following is my unboxing for Realtek Ameba RTL8195.

1.5 Testing

  For testing, I used Realtek Ameba RTL8195 on Windows 10, OS X and Ubuntu. I also used Arduino Sidekick Basic kit for electronic components and several sensor devices.

2. Setting Up Realtek Ameba RTL8195

  This chapter explains how to work on setting up Realtek Ameba RTL8195 board.

2.1 Getting Started

  In this chapter, we set up Realtek Ameba RTL8195 board development using Arduino software. Then, try to build a simple Realtek Ameba RTL8195 app, Blinking.

  Let's start.

2.2 Installing Arduino Software

  If you have experience in Arduino development, you can use Arduino IDE to develop Realtek Ameba RTL8195 board too. You can download Arduino software from . I recommend to use Arduino 1.8.5 or later.

  After downloaded, install Arduino software.Now you can open Arduino IDE.

2.3 Configuring Arduino for Realtek Ameba RTL8195

  This section is to configure Realtek Ameba RTL8195 on Arduino IDE. You computer should be connected to Internet network. Now open your Arduino and open Preferences so you get a dialog that is shown in Figure below.

  Click Install button to install the board. If completed, you can verify that Realtek Ameba RTL8195 board is shown in target list. You can click menu Tools -> Board . You should see Realtek Ameba RTL8195 board in the list.

  Now you are ready to develop the program.

2.4 Connecting Realtek Ameba RTL8195 board to Computer

  Based on the datasheet, Realtek Ameba RTL8195 board pinout is shown in Figure below.

  If you're working on Windows platform, you can see Realtek Ameba RTL8195 detect on Device Manager.

  In Mac platform, this board usually is recognized as /dev/cu.usbmodem1422.

2.5 Hello Realtek Ameba RTL8195: Blinking LED

  In this section, we build a blinking LED program using Blink program from Arduino software. We need a LED and jumper cables to implement this demo.

  The following is pinout of Realtek Ameba RTL8195.

  The following is the left pinout of Realtek Ameba RTL8195.

  The following is the right pinout of Realtek Ameba RTL8195.

  Let's start to write our Blink program. In this demo, I use Arduino 1.8.5. You can perform the following wiring:

  Then, you can see Blink source code as follows.

  #define MYLED 7 void setup() {

  pinMode(MYLED, OUTPUT);

  } void loop() { // turn the LED on (HIGH is the voltage

  digitalWrite(MYLED, HIGH);

  Select serial port for your Realtek Ameba RTL8195 board, for instance COM6 in Windows platform. On my MacOS, it's selected on /dev/cu.usbmodem1422.

  After pressed, you can see LED is blinking. A sample output of blinking program can be seen in Figure below.

2.6 Updating Program

  If you have modified the program and want to upload to Realtek Ameba RTL8195 board, you compile and upload the program too.

3. Writing and Reading Digital Data

  In this chapter I'm going to explain how to work with digital input/output on Realtek Ameba RTL8195 board.

3.1 Getting Started

  To write a digital data on Realtek Ameba RTL8195 board, we can use digitalWrite() and use digitalRead() to read data from a digital output. To use Realtek Ameba RTL8195 digital I/O pins, we must define them using pinMode() with passing OUTPUT or INPUT parameter. The following is a scheme of Realtek Ameba RTL8195 board pinouts for digital Input/Output.

  The left pinout of Realtek Ameba RTL8195.

  The right pinout of Realtek Ameba RTL8195.

  In this chapter, we build a program to illustrate how Realtek Ameba RTL8195 digital input/output

3.2 Wiring

  We build the following wiring for the demo.

  LED is connected to Realtek Ameba RTL8195 pin 7 Push button is connected to Realtek Ameba RTL8195 pin 8 The following is a sample of wiring.

3.3 Writing a Program

  To create a program, we just open Arduino IDE and write this code.

  int led = 7 ; int

  8

  pushButton = ;

  int

  state = ;

  void setup () {

  pinMode(led, OUTPUT); pinMode(pushButton, INPUT); }

  void loop () {

  state = digitalRead(pushButton); digitalWrite(led,state);

  300

  delay( ); }

3.4 Testing

  Now you can upload and run this program to Realtek Ameba RTL8195 board. Then, press Reset button.

  For testing, try to press pushbutton. You should see a lighting LED on the board.

4. Serial Communication (UART)

  In this chapter I'm going to explain how to access UART on Realtek Ameba RTL8195 board.

4.1 Getting Started

  Realtek Ameba RTL8195 provides UART which can be accessed via Serial library or SoftwareSerial. Further information about Serial object, you can read it on e can call Serial.read() to read one byte from UART and Serial.write() to write one byte into UART.

  UART is represented as RX and TX pins. You can see UART pins on Arduino Uno board. The following is Realtek Ameba RTL8195 pinout.

  The following is the right pinout of Realtek Ameba RTL8195.

  Serial library on Realtek Ameba RTL8195 uses Log UART pinouts. In this chapter, we try to access Realtek Ameba RTL8195 Log UART that is shown in lower right pinout. Its pins are LOGUART_TX and LOGUART_RX.

  You can see the physical log UART in Figure below.

  We will access Log UART with additional serial tools that is attached on log UART from Realtek Ameba RTL8195 board.

4.2 Hello UART

  In this section, we try to use UART on Realtek Ameba RTL8195 board.

4.2.1 Preparation

  On Realtek Ameba RTL8195, you can use UART pins on other digital pins. We can communicate with Realtek Ameba RTL8195 board from computer via UART using SoftwareSerial. In this scenario, we need Serial hardware. The following is a list of UART tool you can use for this demo.

  SparkFun FTDI Basic Breakout - 3.3V FTDI Cable 5V VCC-3.3V I/O, Foca,

  In this scenario, I use Foca tool from iTead. We connect UART/Serial tool to Realtek Ameba RTL8195 log UART pins.

  Now we connect UART tool to Realtek Ameba RTL8195 LOG UART. The following is our wiring: UART/Serial tool Tx is connected to Realtek Ameba RTL8195 Pin LOGUART_RX UART/Serial tool Rx is connected to Realtek Ameba RTL8195 Pin LOGUART_TX A sample of hardware implementation can be seen in Figure below.

  4.2.3 Wiring

  In this scenario, we use the same wiring from chapter 3. We will show pressed state from push button on Serial.

  4.2.4 Writing a Program state = digitalRead(pushButton); digitalWrite(led,state); Serial.print("State="); Serial.println(state);

  300

  delay( ); }

4.2.5 Testing

  Now you can upload and run program. Don't forget to set board target with Realtek Ameba RTL8195. Read section 2.5 to upload the program.

  On computer which is attached with UART/Serial too, run your serial application, for instance, I use CoolTermnstal and run this app. Now you can connect UART/Serial USB tool to your computer.

5. Working with Analog I/O

  This chapter explains how to work with Realtek Ameba RTL8195 Analog I/O.

5.1 Getting Started

  Realtek Ameba RTL8195 board provides Analog I/O which can be connected to sensor or actuator devices. Arduino Uno has PWM on digital pins: 3,4, 8, 9, 10, 11, 12, and 13. See the following of Realtek Ameba RTL8195 Analog input which is represented A0, A1, A2. Realtek Ameba RTL8195 also has analog output pin on DAC.

  The following is pinout of Realtek Ameba RTL8195.

  The right pinout of Realtek Ameba RTL8195.

  In this chapter, we try to access Realtek Ameba RTL8195 Analog I/O using Arduino software. There are three scenarios for our cases:

5.2 Demo Analog Output (PWM) : RGB LED

  In this scenario we build a program to control RGB LED color using Realtek Ameba RTL8195 Analog output (PWM). RGB LED has 4 pins that you can see it on Figure below.

  To understand these pins, you can see the following Figure.

  Pin 1: Red Pin 2: Common pin Pin 3: Green Pin 4: Blue Now we can start to build a program and hardware implementation.

5.2.1 Wiring For our testing, we configure the following PWM pins.

  RGB LED pin 1 (red) is connected to Realtek Ameba RTL8195 pin 9 RGB LED pin 2 is connected to Realtek Ameba RTL8195 3.3V (VCC +3.3V) or GND (depending on your RGB LED) RGB LED pin 3 (green) is connected to Realtek Ameba RTL8195 pin 10 RGB LED pin 4 (blue) is connected to Realtek Ameba RTL8195 pin 11 Here is a sample implementation with Realtek Ameba RTL8195 and RGB Led.

5.2.2 Writing Program

  To display a certain color, we must combine colors from red, green, blue. Realtek Ameba RTL8195 provides API for PWM like Arduino API such as analogWrite() and analogRead() with analog value from 0 to 255. Let's start to build a program. Firstly, open Arduino Software. Then, write these scripts.

  int = 9 ;

  redPin

  int = 10 ;

  greenPin

  int bluePin = 11 ; void setup() {

  pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT);

  9600 );

  Serial.begin(

  } void loop() { // red

  255 , , );

  setColor(

  );

  Serial.println( "red" delay( 1000 );

  // green

  setColor( , 255 , );

  );

  Serial.println( "green"

  1000 );

  delay(

  // blue

  setColor( , , 255 );

  } Upload and run the program. You should see several color on RGB LED. The following is a sample demo on RGB LED.

5.3 Demo Analog Input: Working with Potentiometer

  In this section, we learn how to read analog input on Realtek Ameba RTL8195 board. For illustration, I use Potentiometer as analog input source. Our scenario is to read analog value from Potentiometer. Then, display it on Serial Monitor. Realtek Ameba RTL8195 has Analog inputs on A0, A1, A2. If you want to work with many analog inputs, you must expand it using ICs based ADC. In this section, we are working on Realtek Ameba RTL8195 Analog inputs. Let's start!.

  5.3.1 Wiring To understand Potentiometer, you see its scheme in Figure below.

5.3.2 Writing Program Firstly, create a program using Arduino IDE. To read analog input, we can use analogRead() function.

  Ok, Let's write these scripts.

  int val = ; void setup

  () {

  9600

  Serial.begin( );

5.4 Writing Analog Output.

  In this section, we learn how to work with analog ouput. Realtek Ameba RTL8195 provides DAC on DAC0 pin. We explore this pin.

5.4.1 Wiring

  For demo, we connect a LED to DAC pin. You also need UART tool to connect Realtek Ameba RTL8195 LOG UART. The following is our wiring demo.

  void

  loop() { analogWrite(DAC0, val); Serial.print( "DAC=" ); Serial.println(val);

  • + = 25 ;

  val val

  if (val > 255 )

  val = ; delay( 1000 );

  }

5.4.3 Testing

  Compile and upload the program to Realtek Ameba RTL8195. You should see lighting LED with moving intensity.

  You should see program on UART tool.

6. Working with I2C

  In this chapter we learn how to work with I2C on Realtek Ameba RTL8195 board using Sketch program.

6.1 Getting Started

  The I2C (Inter-Integrated Circuit) bus was designed by Philips in the early '80s to allow easy communication between components which reside on the same circuit board. TWI stands for Two Wire Interface and for most marts this bus is identical to I²C. The name TWI was introduced by Atmel and other companies to avoid conflicts with trademark issues related to I²C.

  I2C bus consists of two wires, SDA (Serial Data Line) and SCL (Serial Clock Line). You can see I2C pins on Realtek Ameba RTL8195 board, shown in Figure below.

  The right pinout of Realtek Ameba RTL8195.

  For testing, I used PCF8591 AD/DA Converter module with sensor and actuator devices. You can find it on the following online store:

  This module has mini form model too, for instance, you can find it on Amazon,

  

  

  In this chapter, we build a program to access sensor via I2C using Arduino software on Realtek Ameba RTL8195 board.

6.2 Writing Program

  We use PCF8591 AD/DA Converter as I2C source. You can connect PCF8591 AD/DA Converter to Realtek Ameba RTL8195 board directly.

  The following is our wiring lab: PCF8591 AD/DA Converter SDA --> Realtek Ameba RTL8195 SDA PCF8591 AD/DA Converter SCL --> Realtek Ameba RTL8195 CLK PCF8591 AD/DA Converter VCC --> Realtek Ameba RTL8195 VCC 3.3V (+3.3V) PCF8591 AD/DA Converter GND --> Realtek Ameba RTL8195 GND Hardware implementation can be shown in Figure below.

6.3 Writing Program

  We use I2C on Realtek Ameba RTL8195 board using Wire library like Arduino way. PCF8591 AD/DA Converter module has three sensor devices: Thermistor, Photo-voltaic cell and Potentiometer. This module runs on I2C bus with address 0x90. In this case, we read all sensor data.

  Open Arduino IDE and write this code.

  #include "Wire.h" #define PCF8591 (0x90 >> 1) // I2C bus address #define PCF8591_ADC_CH0 0x00 // thermistor #define PCF8591_ADC_CH1 0x01 // photo-voltaic cell #define PCF8591_ADC_CH2 0x02 #define PCF8591_ADC_CH3 0x03 // potentiometer

  byte ADC1, ADC2, ADC3;

  void setup() {

  Wire.begin();

  9600 );

  Serial.begin(

  } void loop() { // read thermistor

  Wire.beginTransmission(PCF8591); Wire.write(PCF8591_ADC_CH0); Wire.endTransmission();

  2 );

  Wire.requestFrom(PCF8591, delay( 300 ); ADC1 = Wire.read();

  Wire.beginTransmission(PCF8591); Wire.write(PCF8591_ADC_CH3); Wire.endTransmission(); Wire.requestFrom(PCF8591,

  2 ); 300 );

  delay(

  =

  ADC3 Wire.read(); ADC3 = Wire.read(); Serial.print( "potentiometer=" ); Serial.println(ADC3);

  1000 );

  delay(

  } Save this code as I2CSensor.

6.4 Testing

  Now you can upload and run the program to Realtek Ameba RTL8195 board board. If done, open serial tool and connect to Realtek Ameba RTL8195 LOG UART to see the program output. The following is a sample output.

7. Working with SPI

  In this chapter I'm going to explain how to work with SPI on Realtek Ameba RTL8195 board.

7.1 Getting Started

  The Serial Peripheral Interface (SPI) is a communication bus that is used to interface one or more slave peripheral integrated circuits (ICs) to a single master SPI device; usually a microcontroller or microprocessor of some sort. SPI in Arduino Uno board can be defined on the following pins:

  MOSI on DOUT pin (Digital pin 11) MISO on DIN pin (Digital pin 12) SCLK on SCK (Digital pin 13) You can see these SPI pins on Realtek Ameba RTL8195 board, shown in Figure below. The right pinout of Realtek Ameba RTL8195.

  We can only use one SPI on Realtek Ameba RTL8195 board with SPI master mode. We develop program based SPI using SPI library .

7.2 Wiring

  To develop SPI loopback, we can connect MOSI pin to MISO pin. This means you connect pin 12 to pin 11 using cable. You also need UART tool to connect Realtek Ameba RTL8195 LOG UART.

  The following is a sample of wiring.

7.3 Writing a Program

  Firstly, we write a program for Realtek Ameba RTL8195. Write these codes on Arduino IDE.

  #include <SPI.h>

  byte sendData,recvData;

  void setup () {

  SPI.begin();

  115200

  Serial.begin( ); }

  // source: // http://forum.arduino.cc/index.php?topic=197633.0 randomDigit

  byte () {

  unsigned long t = micros();

  byte r = (t %

  10 ) + 1 ; for

  1

  4

  (byte i = ; i <= ; i++) {

  10

  t /= ; r *= ((t %

  10 ) + 1 );

  r %=

  11 ;

  }

  return

  1

  (r - ); }

  void loop

  () { sendData = randomDigit(); recvData = SPI.transfer(sendData); Serial.print("Send=");

7.4 Testing

  Now you can upload program to Realtek Ameba RTL8195 board. If done, open serial tool from Arduino. You should see received data from SPI.

8. Working with EEPROM

  In this chapter I'm going to explain how to work with EEPROM in Realtek Ameba RTL8195.

8.1 Getting Started

  EEPROM stands for Electrically Erasable Programmable Read-Only Memory and is a type of non- volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed. Realtek Ameba RTL8195 does not support EEPROM library from Arduino. It supports for FlashMemory library.

8.2 EEPROM Demo

  In this section, we try to access EEPROM on Realtek Ameba RTL8195. We do the following actions: allocate memory from 0x4000 to 0xFC000 read one word memory using readWord() write one word memory using writeWord()

  To achieve these actions, you can start to write program on Arduino software. Write this program.

  #include <FlashMemory.h> void

  setup() {

  unsigned int

  value;

  /* request flash size 0x4000 from 0xFC000 */

  FlashMemory.begin( 0xFC000 , 0x4000 );

  /* read one word (32-bit) from 0xFC000 plus offset 0x3F00 */ = 0x3F00 );

  value FlashMemory.readWord( printf( "value is 0x%08X\r\n" , value);

  if (value == 0xFFFFFFFF ) { = ;

  value

  else

  } {

  To see a changed value, try to press Reset button again.

  You also can press Reset button on Realtek Ameba RTL8195 so you should see the value is changing.

9. Building Internet of Things Application

  In this chapter I'm going to explain how to connect Realtek Ameba RTL8195 board to a network.

91 Getting Started

  Realtek Ameba RTL8195 has built-in WIFi module. In this chapter, we explore how Realtek Ameba RTL8195 connect to Internet network.

  Let's start!

9.2 Scanning Existing WiFi Hotspot

  In this section, we try to scan existing WiFi hotspot. We use program samples from Realtek Ameba RTL8195. You can use the program sample on File -> Examples -> ScanNetworks.

  You will get this program.

  #include <WiFi.h> void

  setup() {

  //Initialize serial and wait for port to open:

  Serial.begin( 9600 );

  while ( ! Serial) { // wait for serial port to connect. Needed for native USB port only

  ; }

  // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { );

  Serial.println( "WiFi shield not present"

  // don't continue: while ( true );

  }

  =

  String fv WiFi.firmwareVersion();

  if != ) {

  (fv "1.1.0" Serial.println( "Please upgrade the firmware" ); }

  // Print WiFi MAC address:

  printMacAddress();

  1 ], HEX);

  Serial.print(mac[

  );

  Serial.print( ":" Serial.print(mac[

  2 ], HEX);

  Serial.print( ":" );

  3 ], HEX);

  Serial.print(mac[

  );

  Serial.print( ":" Serial.print(mac[

  4 ], HEX);

  Serial.print( ":" );

  5 ], HEX);

  Serial.println(mac[

  } void listNetworks() { // scan for nearby networks:

  );

  Serial.println( "** Scan Networks **"

  int =

  numSsid WiFi.scanNetworks();

  • - if (numSsid == 1 ) {

  Serial.println( "Couldn't get a wifi connection" );

  while );

  ( true }

  // print the list of networks seen:

  Serial.print( "number of available networks:" ); Serial.println(numSsid);

  // print the network number and name for each network found: for

  • ++ ( int thisNet = ; thisNet < numSsid; thisNet ) {

  Serial.print(thisNet);

  );

  Serial.print( ") " Serial.print(WiFi.SSID(thisNet)); Serial.print( "\tSignal: " ); Serial.print(WiFi.RSSI(thisNet));

  );

  Serial.print( " dBm"

  break ; case SECURITY_WPA_TKIP_PSK:

  Serial.print( "WPA TKIP" );

  break ; case

  SECURITY_WPA_AES_PSK: Serial.print( "WPA AES" );

  break ; case

  SECURITY_WPA2_AES_PSK:

  );

  Serial.print( "WPA2 AES"

  break ; case SECURITY_WPA2_TKIP_PSK:

  );

  Serial.print( "WPA2 TKIP"

  break ; case SECURITY_WPA2_MIXED_PSK:

  Serial.print( "WPA2 Mixed" );

  break ; case

  SECURITY_WPA_WPA2_MIXED: Serial.print( "WPA/WPA2 AES" );

  break ;

  }

  } void printEncryptionType( int thisType) { // read the encryption type and print out the name: switch

  (thisType) {

  case

  ENC_TYPE_WEP: Serial.println( "WEP" );

  break ; case

  ENC_TYPE_TKIP:

  

);

  Serial.println( "WPA"

  break ; case ENC_TYPE_CCMP:

9.3 Building IoT Application

  In this section, we build IoT application on Realtek Ameba RTL8195. We need three LEDs. We will turn on/off LEDs from a browser.

9.3.1 Wiring

  We connect three LEDs to digital pin 8, 9 and 10. You also need to connect Realtek Ameba RTL8195 LOG UART through UART tool.

  The following is my wiring.

  char = ;

  ssid[] "ssid"

  char = ;

  pass[] "pass"

  int status = WL_IDLE_STATUS;

  WiFiServer server(

  80 ); void

  setup() {

  9600 );

  Serial.begin( delay(

  10 ); // prepare GPIO5

  pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); digitalWrite(led1, );

  );

  digitalWrite(led2,

  );

  digitalWrite(led3,

  // Connect to WiFi network while (status != WL_CONNECTED) { );

  Serial.print( "Attempting to connect to SSID: " Serial.println(ssid); status = WiFi.begin(ssid, pass);

  // wait 10 seconds for connection: 10000 );

  delay( } Serial.println( "" ); Serial.println( "WiFi connected" );

  // Start the server

  server.begin();

  while ( !

  client.available()){

  1 );

  delay( }

  // Read the first line of the request =

  );

  String req client.readStringUntil( '\r' Serial.println(req); client.flush();

  // Match the request int = ;

  val1

  int = ;

  val2

  int val3 = ; int ledreq = ; if ) - != 1 ) {

  (req.indexOf( "/gpio1/0"

  = ;

  val1 ledreq =

  1 ;

  }

  else if ) != - 1 ) {

  (req.indexOf( "/gpio1/1"

  = 1 ;

  val1 ledreq =

  1 ;

  }

  • - else if ) != 1 ) {

  (req.indexOf( "/gpio2/0"

  = ;

  val2 ledreq =

  2 ;

  }

  else if ) != 1 - ) {

  (req.indexOf( "/gpio2/1"

  = 1 ;

  val2 req =

  2 ;

  }

  else

  • - if ) != 1 ) {

  (req.indexOf( "/gpio3/0"

  = ;

  val3

  // Prepare the response

  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE

  ; HTML>\r\n<html>\r\n" if (ledreq == 1 ) {

  s += "LED1 is " ; s += (val1) ? "ON" : "OFF" ;

  else if (ledreq == 2 ) {

  }

  • += ;

  s "LED2 is " s += (val2) ? "ON" : "OFF" ; } else if (ledreq ==

  3 ) { += ;

  s "LED3 is "

  • += ? : ;

  s (val3) "ON" "OFF" } s += "</html>\n" ;

  // Send the response to the client

  client.print(s); delay(

  1 );

  client.stop();

  );

  Serial.println( "Client disonnected"

  }

  Open a browser and navigate to http://<server>/gpio1/1. This URL will turn on LED 1.

  You can turn off LED 1 by calling URL http://<server>/gpio1/0.

  On serial application, you can see program output.

  Source Code

  You can download source code on .

  Contact

  If you have question related to this book, please contact me at aguskur@hotmail.com . My blog: