Remote variable interface

<< Click to Display Table of Contents >>

Navigation:  Hardware Modules > aMG EthernetINF > Webserver CGI >

Remote variable interface

Previous pageReturn to chapter overviewNext page

Description

The interface provide access to Read/Write to local variable via remote (GET method). Build and download model webserver_demo.mdl to target for below demo.

varget.cgi

The varget.cgi provide access Read to a specified variable name.

Syntax: /varget.cgi?name=<name>

Example:

To get variable name 'adc', input http://192.168.1.41/varget.cgi?name=adc on address bar of web browser software.

Response:

webserver_cgi_verget_web

Note: Web server response the request as text file, user can use http://192.168.1.41/adc.txt for shortcut.

varset.cgi

The varset.cgi provide access Write to a specified variable name.

Syntax: /varset.cgi?name=<name>&value=<value>

Example:

To control PWM duty cycle, write value 50 to variable name 'pwm'. Input http://192.168.1.41/varset.cgi?name=pwm&value=50

webserver_cgi_verset_web

HTML Form

Both varget.cgi and varset.cgi are access by GET method, it can also work with html form.

Example:

Save below code to file varget.html, then upload to store in web server storage.

<!DOCTYPE html>

<html>

<body>

<form action="/varget.cgi">

Variable name: <input type="text" name="name"><input type="submit" value="Submit">

</form>

</body>

</html>

 

Testing: Request varget.html via web browser.

webserver_cgi_verget_form