need help with BS2 functions
stargazer2050
Posts: 89
quickstart
BS2 functions
Radio Control receiver
trying to read the pulsein:
NEED to know what IO PIN to put it on?
What the word 'STATE' indicates????
ETC.
BS2 functions
Radio Control receiver
trying to read the pulsein:
NEED to know what IO PIN to put it on?
What the word 'STATE' indicates????
ETC.
con ' SHIFTIN Constants MSBPRE = 0 LSBPRE = 1 MSBPOST = 2 LSBPOST = 3 OnClock = 4 ' Used for I2C ' SHIFTOUT Constants LSBFIRST = 0 MSBFIRST = 1 ' SEROUT/SERIN Constants NInv = 1 Inv = 0 cntMin = 400 ' Minimum waitcnt value to prevent lock-up DEBUG_BAUD = 9600 ' DEBUG Serial speed - maximum! DEBUG_MODE = 1 ' Non-Inverted SCL = 28 SDA = 29 #1, HOME, #8, BKSP, TAB, LF, CLREOL, CLRDN, CR, #16, CLS ' PST formmatting control OBJ BS2 : "BS2_Functions" ' Create BS2 Objectterm term : "FullDuplexSerial" VAR long s, ms, us,Last_Freq,Last_FreqB Byte DataIn[50],DEBUG_PIN,DEBUGIN_PIN word RCvar PUB Start 'dira[0] := 0 s := clkfreq ' Clock cycles for 1 s ms := clkfreq / 1_000 ' Clock cycles for 1 ms us := clkfreq / 1_000_000 ' Clock cycles for 1 us Last_Freq := 0 ' Holds last setting for FREQOUT_SET BS2.start (31,30) ' Initialize BS2 Object timing, Rx and Tx pins for DEBUG repeat RCvar := BS2.PULSIN(0,state???) 'MyVariable := BS2.PULSIN(pin,state) term.dec(HOME) term.tx(CLS) term.str(string("RCvar")) term.tx(CR) term.dec(RCvar) WaitCnt(ClkFreq / 2 + Cnt)
Comments
Tnx kuroneko, ok understand state better, ill use a one i guess
On where to put pin, i meant where to address it in this bs2 function library, i have it on pin zero.
Hi mike, congrats on 20k responses!
To explain, since i drive you nuts so much lately, im a retired wedding photographer with some programming background in excel application basic. I have almost every parallax sensor running after starting my new hobby 8 months ago
Since im limited in this knowledge, im looking for a semi turn key method for getting the radio control variables to show up using fullduplexserial.
Im struggling with this way, radioloop.spin and pvh_autopilot, which outputs to a tv which doesnt fit in with me monitoring everything with full duplex.
Hope it all makes more sense now.
Tnx, eddie
.
How many RC channels do you want to monitor?
The pulsein method is pretty slow if you're trying to capture a bunch of channels.
I'm sure I have some code that does what you want with up to six channels. I'll try to find it.
6 channels
I posted my modified (and now tested) object here.
I'm not the author of most of it (and not of the hard parts). I just made the object usable with any of the Prop's I/O pins.