Skip to content

arduino source code to create a simple Wifi server reading GET parameters

License

Notifications You must be signed in to change notification settings

gotsunami/ArduinoSimpleGetServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WifiSimpleGetServer

arduino source code to create a simple Wifi server reading GET parameters

Introduction

This project is a very simple extension of the WifiWebServer that adds the possibility to read the GET parameters of the request URL. This example code does nothing but display the GET parameters in the reply.

This Arduino code was tested only with a Genuino MKR1000.

WifiSimpleGetServer is the minimal version of the code. WifiSimpleGetServerDebug outputs some debug information on Serial. WifiGetServerLED turns on and off the onboard LED (pin 6).

Requirements

How to test

  • Load the sketch in Arduino IDE
  • Update the SSID and password to match your local network
  • Compile and upload to your board
  • Open the Serial Monitor and wait for the board to connect
  • Copy the IP address, for instance 192.168.0.35
  • Open a web browser (on a device also connected to your local network) and go to:
    • http://192.168.0.35/?c=1&d=2
  • The browser should display
    • c = 1
    • d = 2

How to do your own WifiGetServerAndDoSomething

  • Follow the previous steps to be sure it works properly
  • Edit function String handle(String **params, int nb)
    • String **params is the list of GET parameters read from the request: [["a", "1"], ["b", "2"]]
    • nb is the size of params, useful to create loops
    • The returned String value will be inserted into the body of the reply.
    • The only limit now is your imagination and your board :) (See WifiGetServerLED for an example).
  • Compile and upload to your board

About

arduino source code to create a simple Wifi server reading GET parameters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%