Commits

iorodeo  committed f24b7bc

Added examples demonstrating how to use set current values from Matlab using the
flask based web server for the LED controller.

  • Participants
  • Parent commits 5cee7c2

Comments (0)

Files changed (3)

 *.scad
 *.stl
 *.pkl
+*.asv
 *.komodo*
 *.egg-info
 .DS_Store

File host/current_controller/examples/flask_webserver/set_current.m

+function set_current(channel, value)
+% set_current
+%
+% Usage:
+% 
+%  set_current('a',100)
+% 
+%  channel = curernt controller channel - 'a', 'b', 'c' or 'd'
+%  value = current value in mA (0-1000)
+%
+% Demonstrates how to use the urlread function to set the current for a 
+% given channel on IO Rodeo's LED controller when running the web server
+% interface.
+% 
+% Note, assumes that web server is running on port 5000 - which is the
+% default.
+%
+% Also, assumes that you are accessing the computer. For, an example of 
+% controlling an LED Controller on a remote computer see
+% set_current_remote.m 
+% -------------------------------------------------------------------------
+
+url = sprintf('http://localhost:5000/set_current?channel=%s&value=%d',channel,value);
+msg = urlread(url);

File host/current_controller/examples/flask_webserver/set_current_remote.m

+function set_current_remote(ip, channel ,value)
+% set_current_remote
+%
+% Usage:
+%
+%  set_current_remote('192.168.0.10', 'a', 100)
+%
+%  ip = IP of remote computer as string
+%  channel = curernt controller channel - 'a', 'b', 'c' or 'd'
+%  value = current value in mA (0-1000)
+%
+% Demonstrate how to use the urlread function to set the current for a 
+% given channel on IO Rodeo's LED controller when running the web server
+% interface on a remote computer.
+%
+% Note, assumes that web server is running on port 5000 - which is the
+% default.
+% -------------------------------------------------------------------------
+url = sprintf('http://%s:5000/set_current?channel=%s&value=%d',ip,channel,value);
+msg = urlread(url);