Access to spectrum data

11 years 8 months ago #29526197 by Michael Burton
I would like to get the command data from the spectrum radio for use in my script. Is this something that can be accessed.

I want to read the joystick positions on the transmitter and use them in my program.

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526199 by roboteq
Replied by roboteq on topic Re:Access to spectrum data
try getvalue(_K, n) where n is the channel number

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526201 by Michael Burton
Where did you find this information. I see nothing in the documentation. Do you have additional information for spectrum perimeters that I can read in this envirnment?

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526203 by Michael Burton
I get \"_k is not a valid named constant\" from the compiler.

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526205 by roboteq
Replied by roboteq on topic Re:Access to spectrum data
the query ?K is what you would use from the console to read the spektrum radio data. Test this first.

To read a operating parameter from microbasic you need to use the getvalue() function and replace the ? with _. So _K.

But you may have to do this while the controller is attached to the PC. This is because _K is a relatively new addition and that it may not be in the off-line command dictionary.

When the controller is attached, whenever you click on the Scripting tab, the controller dumps the latest list of commands implemented in the firmware.

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526207 by Michael Burton
It works from the console using the ?_K
I am not sure what the numbers represent.

This is the code I tried to compile.


print(\"spectrum data 1 \", getvalue(_K, 1), \"\\n\")
print(\"spectrum data 2 \", getvalue(_K, 2), \"\\n\")

these are the errors
1 \'_K\' is not a valid named constant
2 \'_K\' is not a valid named constant

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526209 by roboteq
Replied by roboteq on topic Re:Access to spectrum data
Strange that it wouldnt work.

Try getvalue(33,1) and getvalue(33,2)

To help us troublshoot:

Go to console tab
Clear Log
Go to Scripting tab
Go back to console tab
Copy log

Then paste the log here on in a file and send.

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526211 by Michael Burton
Not sure exactly what you want.
I cleared the con log.
put
getvalue(33,1)
getvalue(33,2)

in the script compiled and copied the output

# C
|~
|~=FL:0:6
|~=CAD:1:0
|~=OVL:2:2
|~=THLD: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:4:5
|?=CB:5:5
|?=VAR:6:5
|?=SR:7:3
|?=CR:8:5
|?=BS:10:3
|?=BSR:11:3
|?=BA:12:3
|?=V:13:2
|?=D:14:4
|?=AI:16:3
|?=PI:17:2
|?=T:18:1
|?=F:19:5
|?=FS:20:0
|?=AD:22:2
|?=DO:23:0
|?=E:24:5
|?=CIS:25:5
|?=CIA:26:5
|?=TM:28:0
|?=LK:29:0
|?=FID:30:7
|?=TRN:31:7
|?=TST:32:5
|?=CP:34:0
# C
#

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526213 by Michael Burton
When I put the
getvalue(33,1)
I get
No sub routine named \'getvalue\' that takes \'2\' arguments

Please Log in or Create an account to join the conversation.

11 years 8 months ago #29526215 by roboteq
Replied by roboteq on topic Re:Access to spectrum data
The console dump shows that not all the codes are correctly captured. This is a bug when used with USB for which we have a fix for.

However, getvalue(33,1) should not give an error. It works fine here. You should install and use the latest roborun.

Code tested:
print(getvalue(33,1))

Please Log in or Create an account to join the conversation.

Time to create page: 0.073 seconds