Easy blue tooth module 30085 help needed !
NehminD
Posts: 5
Hi Guys,
I am a student currently having a project which involve using basic stamp and 2 easy blue tooth module.
The product number for the blue tooth module is 30085.
With the help of the guiding code I am able to finish certain part of it, but I face problem.
The problem is that I have a circuit that will produce binary output and I am not sure what code should I need to change in order for the blue tooth to able to send the binary output from the transmit side to the receiving side.
Can any kind soul out there help me please>??
I am a student currently having a project which involve using basic stamp and 2 easy blue tooth module.
The product number for the blue tooth module is 30085.
With the help of the guiding code I am able to finish certain part of it, but I face problem.
The problem is that I have a circuit that will produce binary output and I am not sure what code should I need to change in order for the blue tooth to able to send the binary output from the transmit side to the receiving side.
Can any kind soul out there help me please>??
Comments
SEROUT <pin>,<Baud>,[noparse][[/noparse]BIN <value> , $0D]
to transmit the value and
SERIN <pin>,<Baud>,[noparse][[/noparse]BIN <value>]
to receive the value at the other end. The SERIN will use the $0D to mark the end of the value and will otherwise ignore it.
Read the BASIC Stamp Syntax and Reference Manual chapters on the SERIN and SEROUT statements and the appendix on the I/O formatters like BIN for details.
I will try out the program first
Hi, I have try to do some coding and hope you all will take some time to look at it.
Below is my code for sending :
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'File: EasySEND.bs2
'
'Purpose: Load on the transmitting unit in the AppNote Easy Bluetooth to Easy Bluetooth Communcation.
'· The example connects to the remote Bluetooth module via serial connection. An address is given to the
'· remote module that the transmitting unit uses to establish connection. 5 seconds after the connection
'· is attempted then a counter variable is sent and incremented by 1 in a repeat loop and then will DEBUG
'· the counter value.
'
'Author: Parallax Technical Support
' ' '' ' '' ' ' Declarations ' ' '' ' '' ' '' ' ''
RX······· PIN 2
TX······· PIN 0
LIGHT1··· PIN 1
Light2··· PIN 3
Light3··· PIN 5
counter·· VAR Bit
'Place the values for each part of the address in the constants below; whereas the first part of the address will be placed in
'addy1 and the second in addy2; for example the address A1:B2:C3[noparse]:D[/noparse]4:E5:F6 would be edited to look like the following:
'··· addy1·· CON· $A1···· <--- A1 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
'··· addy2·· CON· $B2···· <--- B2 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
'··· addy3·· CON· $C3···· <--- C3 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
'··· addy4·· CON· $D4···· <--- D4 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
'··· addy5·· CON· $E5···· <--- E5 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
'··· addy6·· CON· $F6···· <--- F6 from A1:B2:C3[noparse]:D[/noparse]4:E5:F6 goes here
' Place the address for the receiving Easy Bluetooth modules below
'( the address for the Easy Bluetooth module used in the example is 00:17:a0:01:56:b1 )
···· addy1·· CON· $00
···· addy2·· CON· $17
···· addy3·· CON· $a0
···· addy4·· CON· $01
···· addy5·· CON· $56
···· addy6·· CON· $b1
#SELECT $STAMP
· #CASE BS2, BS2E, BS2PE
··· Baud······ CON···· 84
· #CASE BS2SX, BS2P
··· Baud······ CON···· 240
· #CASE BS2PX
··· Baud······ CON···· 396
#ENDSELECT
' ' '' ' '' ' ' Program ' ' '' ' '' ' '' ' ''
Program_Start:
· DEBUG CLS
· PAUSE 3000
· DEBUG CR,"Establishing SPP connection..."
· SEROUT TX, Baud, [noparse][[/noparse]$02,$52,$0A,$08,$00,$64,$01,addy6,addy5,addy4,addy3,addy2,addy1,$01,$03]
· PAUSE 5000
· DEBUG CR,"Entering Transparent mode...",CR
· 'Entering Transparent mode
· SEROUT TX, Baud, [noparse][[/noparse]$02,$52,$11,$01,$00,$64,$01,$03]
· PAUSE 3000
· 'Transmitting counter variable to remote Bluetooth device and to the DEBUG terminal
IF Light1 = 1 THEN
SEROUT 1,Baud,[noparse][[/noparse]BIN 1,$0D]
ENDIF
IF Light1 = 0 THEN
SEROUT 1,Baud,[noparse][[/noparse]BIN 0,$0D]
ENDIF
IF Light2 = 1 THEN
SEROUT 2,Baud,[noparse][[/noparse]BIN 1,$0D]
ENDIF
IF Light2 = 0 THEN
SEROUT 2,Baud,[noparse][[/noparse]BIN 0,$0D]
ENDIF
IF Light3 = 1 THEN
SEROUT 3,Baud,[noparse][[/noparse]BIN 1,$0D]
ENDIF
IF Light3 = 0 THEN
SEROUT 3,Baud,[noparse][[/noparse]BIN 0,$0D]
ENDIF
This will be my code for receive :
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'File: EasyR.bs2
'
'Purpose: Load on the receiving unit in the AppNote Easy Bluetooth to Easy Bluetooth Communcation.
'· The example waits for a value counter to be sent via Bluetooth connection and then will display
'· the value on the DEBUG screen
'
'Author: Parallax Technical Support
' ' '' ' '' ' ' Declarations ' ' '' ' '' ' '' ' ''
RX······· PIN 2
TX······· PIN 0
Temp····· VAR Byte
#SELECT $STAMP
· #CASE BS2, BS2E, BS2PE
··· Baud······ CON···· 84
· #CASE BS2SX, BS2P
··· Baud······ CON···· 240
· #CASE BS2PX
··· Baud······ CON···· 396
#ENDSELECT
' ' '' ' '' ' ' Program ' ' '' ' '' ' '' ' ''
DO
· GOSUB GETVAL
· GOSUB DISPLAY
· PAUSE 5
LOOP
' ' '' ' '' ' ' Subroutines ' ' '' ' '' ' '' '
GETVAL:
· SERIN RX, Baud, [noparse][[/noparse]Temp]······························· ' Waits for a BYTE and puts that value in Temp
RETURN
DISPLAY:
· DEBUG HOME, "Byte = ",DEC Temp,CLREOL,CR· ' Displays the decimal value for Temp
RETURN
AND I am really NEW in this so ANY form of help is wanted
More infomation can be seen in the first post PLS HELP
·
In your original description, you only mentioned the need to send a binary (on / off) value, yet you posted some code that has 3 binary values. What do you want to do?
Yes I am trying to send a binary from 1 bluetooth module to the other.
I think I have trouble with the code.
For example:
IF Light1 = 1 THEN
SEROUT 1,Baud,[noparse][[/noparse]BIN 1,$0D]
ENDIF
I will send Binary 1 to output pin 1 if Light 1 = 1 .
which will explain there is total of 3 light that I will be controlling .
Am i not not really sure which part of the code is wrong, I have least understanding of the basic stamp code.
And for more infromation basically our project will go something like this :
When a speaker say Light 1 on , the wireless will process a binary to a circut and transmit a binary output to·the transmit side and then send to the receiver which will light the light of each different light and we can only set a binary at a time, which means that we can only control 1 Light at a time
Post Edited (NehminD) : 1/30/2010 3:43:13 PM GMT
SEROUT TX,Baud,[noparse][[/noparse]"!",BIN Light1,",",BIN Light2,",",BIN Light3,$0D]
On the receive end, you'd have
SERIN RX,Baud,[noparse][[/noparse]WAIT("!"),BIN temp1,BIN temp2,BIN temp3]
The "!" just marks the beginning of the data and the "," separates the numbers.
The BIN will use the "," or the $0D as a delimiter to mark the end of the number and otherwise ignore it.
So can the coding be like
SEROUT TX(this should be the input pin right?) , Baud,[noparse][[/noparse]"!"(which is my circuit output I suppose ?), BIN light1,$0D]
receive will be
SERIN RX,Baud,[noparse][[/noparse]WAIT("!"),BIN temp1]
And hope that you can explain ! and , in more layman term if can explain relate back to my project will be better.
And thank a lot for your effort by doing so much for a stranger like me