Shop OBEX P1 Docs P2 Docs Learn Events
Easy Bluetooth Help — Parallax Forums

Easy Bluetooth Help

malnickmalnick Posts: 2
edited 2009-06-15 23:05 in BASIC Stamp
I'd like to stream sensor data from two flexiforce's and a memsic 2125 to the Stamp DAQ plugin for excel. My code is below. I can not get the easy blue tooth to establish a connection with my computer. I'm desperate as my project needs to get this thing to work ASAP. Any suggestions welcome.

Thanks
jeff

' =========================================================================
'
'·· File...... FieldTestingCode
'·· Purpose... Memsic 2125 Accelerometer Dual-Axis to Excel
'·· Author.... Jeff Malnick
'·· E-mail.... jpmalnic@nps.edu / malnick@gmail.com
'·· Started...
'·· Updated... 10 june 2009
'·· {$STAMP BS2}
'·· {$PBASIC 2.5}
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'Field testing code for data collection using the basic stamp homework board attached
'to a weapon and transmitting x, y and trigger pressure data (and later cheek weld) to
'a remote machine for data base profiling
'
[noparse][[/noparse] I/O Definitions, Variables,& Constants ]
BluTx·········· PIN···· 1
BluRx·········· PIN···· 0
Xin············ PIN···· 14····················· ' X input from Memsic 2125
Yin············ PIN···· 13····················· ' Y input from Memsic 2125
sPin··········· CON···· 16····················· ' Serial transmit pin
FlexiInput01··· CON···· 15····················· ' Flexiforce sensor circuit 01
FlexiInput02··· CON···· 12····················· ' Flexiforce sensor circuit 02
'
[noparse][[/noparse] Duel Axis ]
Baud··········· CON···· 84····················· ' 9600, 8-bit, no polarity, true
Scale·········· CON···· $200··················· ' 2.0 us per unit
HiPulse········ CON···· 1······················ ' measure high-going pulse
LoPulse········ CON···· 3
xRaw··········· VAR···· Word··················· ' pulse from Memsic 2125
xmG············ VAR···· Word··················· ' g force (1000ths)
yRaw··········· VAR···· Word
ymG············ VAR···· Word
'
[noparse][[/noparse] Profile Variables ]
timer·········· VAR···· Word
FlexiProfile··· VAR···· Word
'
[noparse][[/noparse] Bluetooth ]
nCount········· VAR···· Byte
myByte········· VAR···· Byte·················· ' Byte to establish connection & used for workspace
'
[noparse][[/noparse]FlexiForce]
FlexiRaw01····· VAR···· Word
FlexiRaw02····· VAR···· Word
'**************************************************************************
'
[noparse][[/noparse]StampDAQ Initialization]
'PAUSE 1000
'SEROUT sPin,Baud,[noparse][[/noparse]CR]·································································· 'prep StampDAQ buffer
'SEROUT sPin,Baud,[noparse][[/noparse]CR,"LABEL,time,timer, xRaw, yRaw, FlexiRaw01, FlexiRaw02",CR]······················ 'Label column with rawForce
'
[noparse][[/noparse]Bluetooth Initialization]
'PAUSE 250·········································· ' Waits 1/4 second
'SERIN BluRx, Baud, [noparse][[/noparse]myByte]··························· ' Waiting for byte
'myByte = 0········································· ' Clear the byte value
GOTO Main
'
[noparse][[/noparse] Main ]
Main:
'
[noparse][[/noparse]Memsic Accelerometer]
PULSIN Xin, HiPulse, xRaw···························································· 'read pulse output
PULSIN Yin, HiPulse, yRaw
'
[noparse][[/noparse]FlexiForce]
· HIGH 15·············································································· 'Discharge capacitor
· PAUSE 2
· RCTIME FlexiInput01,1,FlexiRaw01················································ 'Measure R/C charge time
· HIGH 16
· PAUSE 2
· RCTIME FlexiInput02,1,FlexiRaw02
'
[noparse][[/noparse] Stamp DAQ Serial Ouput]
'SEROUT sPin,Baud,[noparse][[/noparse]"DATA,TIME,",",", DEC xRaw,",", DEC yRaw,",", DEC FlexiRaw01,",", DEC FlexiRaw02, CR]· 'Send data to StampDAQ
'
[noparse][[/noparse]Bluetooth Ouput]
SEROUT BluTx,Baud,[noparse][[/noparse]"DATA,TIME,",",", DEC xRaw,",", DEC yRaw,",", DEC FlexiRaw01,",", DEC FlexiRaw02, CR] 'send data to com 9 bluetooth for StampDAQ
'SEROUT 1,84,[noparse][[/noparse]DEC FlexiRaw01, CLS]
'PAUSE 1000
'GOTO FlexiForceProfile································································· 'Goto Flexi Profile
END
'
[noparse][[/noparse] FlexiForce Profile ]
FlexiForceProfile:
DO WHILE (FlexiRaw01 AND FlexiRaw02) < 50000 AND (FlexiRaw01 AND FlexiRaw02) > 4000
· PAUSE 100
· timer = timer + 1
SELECT· timer
CASE = 20
· SEROUT 1,84,[noparse][[/noparse]"Profile: Green"]
CASE < 20
· SEROUT 1,84,[noparse][[/noparse]"Profile: Jerk"]
CASE > 20
· SEROUT 1,84,[noparse][[/noparse]"Profile: Red"]
ENDSELECT
GOTO Main
LOOP
GOTO Main


·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-06-15 16:21
    Start by running the sample test code that is on the Parallax web page. Check your connections. Make sure the bluetooth on the PC is working.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • JDJD Posts: 570
    edited 2009-06-15 23:05
    Malnick,

    As Stephen suggested, can you get the Easy Bluetooth to work with the samples and quick start program? What is the manufacturer of your Bluetooth dongle? or is it an internal component?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
Sign In or Register to comment.