by doddsiedodds » Tue Dec 08, 2009 11:50 pm
by doddsiedodds
Tue Dec 08, 2009 11:50 pm
Hey guys,
I've been working on trying to get robonova to transmit the sensor data from the 2 axis accelerometer to my terminal on the PC with varying degrees of success. I'm taking the value of the sensor in as an INTEGER and so this complicated matters but i've managed to get something working, don't know if anyone is interested.
It's formatted so you can load up the captured transmitted data into excel or numbers etc and plot lovely graphs of your robonova's orientation over time!
- Code: Select all
'------------- DECLARING VARIABLES ------------------'
DIM X AS INTEGER
DIM CurrentDigitUnits AS BYTE
DIM CurrentDigitTens AS BYTE
DIM CurrentDigitHundreds AS BYTE
DIM SendDigit AS BYTE
DIM CarriageReturn AS BYTE
DIM LineFeed AS BYTE
DIM Comma AS BYTE
DIM Space AS BYTE
DIM TXout AS BYTE
CarriageReturn = 13
LineFeed = 10
Space = " "
'-----------------------------------------------------------'
'------------ Transmission Subroutine----------------'
Transmission:
X = AD(0)
CurrentDigitHundreds = X / 100
SendDigit = 48 + CurrentDigitHundreds
ETX 4800, SendDigit
CurrentDigitTens = X / 10
CurrentDigitTens = CurrentDigitTens % 10
SendDigit = 48 + CurrentDigitTens
ETX 4800, SendDigit
CurrentDigitUnits = X % 10
SendDigit = 48 + CurrentDigitUnits
ETX 4800, SendDigit
ETX 4800, LineFeed
ETX 4800, CarriageReturn
GOSUB Transmission
END
'----------------------------------------------------'
I'm aware it looks a bit odd (I'm not taking the modulus of the hundreds digit for example) But it all works a-ok! Line feed and carriage return might result in a double spacing of lines depending on your terminal.
Doddsie
Hey guys,
I've been working on trying to get robonova to transmit the sensor data from the 2 axis accelerometer to my terminal on the PC with varying degrees of success. I'm taking the value of the sensor in as an INTEGER and so this complicated matters but i've managed to get something working, don't know if anyone is interested.
It's formatted so you can load up the captured transmitted data into excel or numbers etc and plot lovely graphs of your robonova's orientation over time!
- Code: Select all
'------------- DECLARING VARIABLES ------------------'
DIM X AS INTEGER
DIM CurrentDigitUnits AS BYTE
DIM CurrentDigitTens AS BYTE
DIM CurrentDigitHundreds AS BYTE
DIM SendDigit AS BYTE
DIM CarriageReturn AS BYTE
DIM LineFeed AS BYTE
DIM Comma AS BYTE
DIM Space AS BYTE
DIM TXout AS BYTE
CarriageReturn = 13
LineFeed = 10
Space = " "
'-----------------------------------------------------------'
'------------ Transmission Subroutine----------------'
Transmission:
X = AD(0)
CurrentDigitHundreds = X / 100
SendDigit = 48 + CurrentDigitHundreds
ETX 4800, SendDigit
CurrentDigitTens = X / 10
CurrentDigitTens = CurrentDigitTens % 10
SendDigit = 48 + CurrentDigitTens
ETX 4800, SendDigit
CurrentDigitUnits = X % 10
SendDigit = 48 + CurrentDigitUnits
ETX 4800, SendDigit
ETX 4800, LineFeed
ETX 4800, CarriageReturn
GOSUB Transmission
END
'----------------------------------------------------'
I'm aware it looks a bit odd (I'm not taking the modulus of the hundreds digit for example) But it all works a-ok! Line feed and carriage return might result in a double spacing of lines depending on your terminal.
Doddsie