I will be using FlexBasic to work with my robot project. Since the robot sends a lot of values that are unsigned, I am wondering how I should go about addressing this.
Typically a robot definition would look like:
OI Mode Packet ID: 35 Data bytes 1, unsigned
The values that would be sent would be 0 to 3.
I tried doing 'Dim oimode as uinteger' , but when I print the value of oimode it is always 1, when it should be other than 1 depending on the mode that it is in.
When I tried this in FlexC, I used unsigned instead of uinteger, and I was seeing similar results. Not sure where the problem is with this one.
What kind of data is the robot sending... is it ASCII or binary? If ASCII, is it hex bytes or decimal?
In the documents, I found this:"...two-way, serial communication at TTL(0 - 5v) levels."
In the OI Command Reference, it states data bytes. Can I extrapolate to ASCII hex bytes. Using this, and using FlexBasic, what would a setting for oimode look like.
"Data bytes" would typically mean binary, in which case to get a byte you'd just do something like:
oimode = robot.rx()
(assuming "robot" is the name of the serial object that is communicating with the robot).
But in general you'll want to add debug code to dump out everything you're sending and receiving from the robot and compare this to the documents to see if it makes sense. It's always possible to misinterpret documentation!
Thanks Eric for the latest FlexGUI update. I had a chance to see how the 'input #' would work out.
I set it up to primarily to work with the telnet connection. It works very well, even better results than what I was getting with the SimpleIDE version.
The big concern now is program size. I basically have a relatively simple program, but it is already using almost half of the memory available. I am using FlexBasic and the fds spin object, now if I add some more objects I will be running out of memory.
Comments
I'll try to fix this soon. For now, the only work-around is to directly use the telnet.rx() function to read the bytes.
Typically a robot definition would look like:
OI Mode Packet ID: 35 Data bytes 1, unsigned
The values that would be sent would be 0 to 3.
I tried doing 'Dim oimode as uinteger' , but when I print the value of oimode it is always 1, when it should be other than 1 depending on the mode that it is in.
When I tried this in FlexC, I used unsigned instead of uinteger, and I was seeing similar results. Not sure where the problem is with this one.
Ray
In the OI Command Reference, it states data bytes. Can I extrapolate to ASCII hex bytes. Using this, and using FlexBasic, what would a setting for oimode look like.
Ray
But in general you'll want to add debug code to dump out everything you're sending and receiving from the robot and compare this to the documents to see if it makes sense. It's always possible to misinterpret documentation!
I set it up to primarily to work with the telnet connection. It works very well, even better results than what I was getting with the SimpleIDE version.
The big concern now is program size. I basically have a relatively simple program, but it is already using almost half of the memory available. I am using FlexBasic and the fds spin object, now if I add some more objects I will be running out of memory.
Ray