bluesmirf and basicstamp
Just got my hands on both a bluesmirf and a basicstamp2+boe, and I'm completely lost. I've managed to get them hooked up and vaguely communicating through Hyperterm, but now I'm wondering about how exactly to program them.
I want to start by using a simple signal sent to the bluesmirf to activate an equally simple function on the bs2 (ie blinking led, or something equally basic). I'm completely new to programming, and have no idea how this would work. Any ideas?
I want to start by using a simple signal sent to the bluesmirf to activate an equally simple function on the bs2 (ie blinking led, or something equally basic). I'm completely new to programming, and have no idea how this would work. Any ideas?
Comments
Amaral
can you send serial data to the bluesmirf ? if yes m send in let's say 9600 baud 8n1 , get the signal that you are seding with SERIN comand and keep going!
Amaral
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
·· Main:
·· IF SERIN 4, 16468, [noparse][[/noparse]a]
·· THEN LOOP
··········· HIGH 8· 'Turn off LED
··········· PAUSE 100··· 'Short pause
··········· LOW 8· 'Turn on LED
··········· PAUSE 500
·GOTO·LOOP· 'Jump back to beginning
If this does work, how would I then turn the loop off with another·SERIN command?·Thanks for any help you can give, I'm lost with this stuff.
SERIN ..... 'take a really long look here is a very powerfull comand with many features, look at modifiers and timeout !
IF var = ... then
...
... 'and so on , I know is very hard to settle donw and read a bunch of stuff with your mind sparkling , but try it , if that does not work , try again !
go ease, and keep going
hope to help
Amaral
Actually found some info on saving the setting and communicating with it...though this is for a different device(Arduino), this guy explains the issues that he had....could be useful
http://tryingtodotheprojects.blogspot.com/2007/12/arduino-over-bluetooth.html
This is the original link with several other articles related to his projects.
http://tryingtodotheprojects.blogspot.com/2007_12_01_archive.html
Post Edited (voodoofish) : 5/8/2008 10:30:38 PM GMT
some notes:
when first installing the bt dongle(trendnet BT usb key) it detected the smirf and added two ports 3 and 4.
I wasn't able to connect to these though for some odd reason and both showed up as connected by default.
Initially i did NOT enter the passkey when asked(1234).
on the second attempt I did. I also noted that the com ports no longer existed. when in hyperterm so I went to the bt tools util and noted that there was now only one com port, com 3, and that it was disabled. I enabled it(it stated some different info, like setting up basic serial connection) and was able to make a connection using com 3.
Another note is that when you are not connected via the bt connection, a red led will blink(first 60 seconds fast for config mode, then slows down).if you are successful in connecting, you will get an additional led that is green(data mode) this is what you want.
Anyway, the above might or might not be useful, but it was important to know that i had a connection before attempting to even try to send data through.
So here is the last bit, my prog and setup is pretty simple, I have a ds1620, an led that blinks when i send the data(push the button), a push button that listens for a button press and the bt smirf device to transmit at the moment.
When i press the button it sends me to a subroutine that gets the ds1620 data. that in turn calls the transblue subroutine. the led turns on when the button press is detected, then turns off after the subroutines finish.
this is all i use for the bt device.
[noparse][[/noparse]snip]
' Project: bluetooth smirf on bs2
'========[noparse][[/noparse]setup for modems]========
BAUDMODE CON 84 ' Set BS2 Baudrate to 9600,8,N,1 Not Inverted (TRUE)
RX PIN 13 ' Receive pin ' connects to the tx pin on the smirf
TX PIN 12 ' Transmit pin 'connects to the rx pin on the smirf
'i used 10k ohm resistoers for the connections to the tx/rx bs2 pins and shorted the cts to rts as stated in the smirf doc.
'the main section was added as an afterthought in case you try to copy and paste.....it should work
main:
do
debug "sending test", CR
high 14 ' your led
gosub transblue
pause 2000
low 14
loop
end
transblue:
PAUSE 100
'this will use the bluetooth transmitter to transmit serial data to the comp
'SEROUT TX, BAUDMODE, [noparse][[/noparse]SDEC DSdata," degrees F", CR]
SEROUT TX, BAUDMODE, [noparse][[/noparse]"test", CR]
RETURN
[noparse][[/noparse]snip]
transblue is called after getting the temp data from the ds1620.
this could be any data though....
Post Edited (voodoofish) : 5/11/2008 8:33:25 AM GMT
Reading through the making things talk page, it looks like he was able to communicate with the device through hyperterm to change the baud rate, but I can't seem to get any response at all from the smirf. is this because I've got it hooked up to the basicstamp at the moment? do I need to use some other device while I change the baud rate?
thanks!
For the first issue on not being able to edit the com settnigs, this is correct. the button was grayed out for me as well, but you can configure it elsewhere. I'll check this out when I get home though I think it can be set up either by editing the com port in the bluetooth utils(whatever is installed on your windows setup).
As far as communication, if you have the baud rate and all set up correctly, have you tried to get it into command mode using "$$$"? without quotes of course...
You have 60 seconds from powerup to get into this mode. once there you should be able to check your settings or configure them if you are set to the correct baud and other settings.
As far as responses, unless you have the stamp set up to respond or transmit continuously, you most likely won't see anything. Just typing stuff into hyperterm won't warrant a response unless again, you have the stamp set up to respond. Also make sure you have the wiring correct, this is critical. I have 2 10k ohm resistors connecting the transmit and receive pins to the bs2.
If anything, I would first program the stamp to transmit a string(something like "4 8 15 16 23 42") to make sure you can receive it first. This is the easiest thing to test when starting wireless transmissions. Once you are receiving in hyperterm, then you can code the bs2 to respond to your commands.
You're at least at a good point where you can connect to it...so, thats half the battle. [noparse]:)[/noparse]
I can post the code(when I get home) I have which I added some two way com to mine now. The bs2 sends data then waits for a response. if it gets the correct response, it resends the all clear.
--edit--
okay to get to the com port config, right click on my computer, click manage then go to device manager. From there click on Ports(com & lpt)
in there you should see the port that you are using(serial over bt com 3 for me) go to properties then port settings and you should be able to modify the settings
Post Edited (voodoofish) : 5/15/2008 6:25:45 AM GMT
I've still got it hooked up to the basic stamp, since I don't have any separate serial communication device, but I'm not looking for any responses from the bs2 just yet, since I still haven't managed to change the baudrate on the smirf from 115200 to 9600...I'll keep fiddling, but no luck so far. I shouldn't need the baudrate to be at 9600 just to get the first few OKs in hyperterm, right? even though I'm using the bs2 to power the smirf at the moment, i figure that since it's establishing a connection with the computer the baudrate shouldn't be an issue.
Post Edited (flippydoo) : 5/20/2008 5:53:14 AM GMT