Share string between Linux API and MicroBasic script
- marcusbarnet
- Topic Author
- Offline
Less
More
- Posts: 69
- Thank you received: 0
10 years 1 month ago #29527757
by marcusbarnet
Share string between Linux API and MicroBasic script was created by marcusbarnet
Is it possible to use a C application in Linux with Roboteq Linux API to send a value to a microbasic script which is already running in the controller?
I mean, I would like to have something like this pseudo-code in my script to run in my controller:
In this way, my controller do nothing if it receives a zero value and it starts processing data only when my C application send a value greater than zero.
If this is possible, what kind of instruction do I have to use to read values from C application via USB?
Thank a lot
I mean, I would like to have something like this pseudo-code in my script to run in my controller:
top:
if (value_received_from_C_application == 0) {
do nothing
}
else do_something;
goto top
In this way, my controller do nothing if it receives a zero value and it starts processing data only when my C application send a value greater than zero.
If this is possible, what kind of instruction do I have to use to read values from C application via USB?
Thank a lot
Please Log in or Create an account to join the conversation.
- cosma
10 years 1 month ago #29527771
by cosma
Replied by cosma on topic Re:Share string between Linux API and MicroBasic script
Use the VAR to exchange numbers with script
from linux: sendcommand VAR, varnumber, varvalue
in script read with getvalue(_VAR, varnumber)
In the other direction. In script setcommand(_VAR, varnumber, varvalue)
Read from linux with getvalue VAR, varnumber
from linux: sendcommand VAR, varnumber, varvalue
in script read with getvalue(_VAR, varnumber)
In the other direction. In script setcommand(_VAR, varnumber, varvalue)
Read from linux with getvalue VAR, varnumber
Please Log in or Create an account to join the conversation.
- marcusbarnet
- Topic Author
- Offline
Less
More
- Posts: 69
- Thank you received: 0
10 years 1 month ago #29527773
by marcusbarnet
Replied by marcusbarnet on topic Re:Share string between Linux API and MicroBasic script
Thank you a lot!
I guess getvalue() is a blocking function in microbasic, isn\'t it?
In this way, I can use it to let the script (and the controller) wait for a string from my C application.
Is it correct if I do this?
In C application:
In microbasic:
May be I\'m not understanding the difference between varnumber and varvalue.
I guess getvalue() is a blocking function in microbasic, isn\'t it?
In this way, I can use it to let the script (and the controller) wait for a string from my C application.
Is it correct if I do this?
In C application:
int variable_name;
cout<<\"- SendCommand(_VAR, variable_name, 10)...\";
if((status = device.SendCommand(_VAR, variable_name, 10)) != RQ_SUCCESS)
cout<<\"failed --> \"<<status<<endl;
else
cout<<\"succeeded.\"<<endl;
In microbasic:
top:
if (getValue(_VAR, variable_name) = 10) then
...
May be I\'m not understanding the difference between varnumber and varvalue.
Please Log in or Create an account to join the conversation.
- marcusbarnet
- Topic Author
- Offline
Less
More
- Posts: 69
- Thank you received: 0
10 years 1 month ago #29527777
by marcusbarnet
Replied by marcusbarnet on topic Re:Share string between Linux API and MicroBasic script
I\'m having problems with API reference.
I found no occurences for SendCommand() function in Roboteq API: what kinf of function do I have to use if I want to send a value to a microbasic script?
I found no occurences for SendCommand() function in Roboteq API: what kinf of function do I have to use if I want to send a value to a microbasic script?
Please Log in or Create an account to join the conversation.
Time to create page: 0.055 seconds