<< Click to Display Table of Contents >> Remote variable interface |
|
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.
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:
Note: Web server response the request as text file, user can use http://192.168.1.41/adc.txt for shortcut.
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
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.