loading
 
VBScript to Serial Port Communication
John from United States  [3 posts]
4 years
Is there a way to be running a VBscript with an if statement, and in the if statement send a command through the serial port?

Example
if cogy > 100 then
'send command "SS<cr>" through the COM port
end if
Steven Gentner from United States  [1370 posts] 4 years
John,

Not directly from the VBScript ... what you do is setup the appropriate variables in VBScript and use them within the Serial module. (Think of separating logic and communication into different modules).

So you would have a VBScript module with

if GetVariable("COG_Y") > 100 then
  SetVariable "serial_cmd", "SS<cr>"
end if

and then in the Serial module you would have

[serial_cmd]

as what gets sent to your serial device. Note the use of a variable to communicate between the VBscript and serial module. You CANNOT call the serial module directly ... you can only configure what is sent. Thus all things like baud, port, etc. are setup using the serial module interface instead of in code.

See attached robofile as example (note we left out the actual tracking to keep things simple).

STeven.


program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index