Connect Raspberry to Basic Stamp 2
satriaoo
Posts: 20
Excuse me, Sir.
I've got project to running hexapod using Raspberry pi and Basic stamp. But, i'm beginner.
I'm trying to connect Raspberry pi model B to Basic Stamp 2 using USB cable. But, always failed. I found the code on this forum about this. I try to copy and paste. But, failed. Is there any 'special' code for connect raspbery pi to basic stamp? So, what should i do? thank you.
btw, on Raspberry, i'm using Stain Phyton Editor.
Thank you, sir :')
I've got project to running hexapod using Raspberry pi and Basic stamp. But, i'm beginner.
I'm trying to connect Raspberry pi model B to Basic Stamp 2 using USB cable. But, always failed. I found the code on this forum about this. I try to copy and paste. But, failed. Is there any 'special' code for connect raspbery pi to basic stamp? So, what should i do? thank you.
btw, on Raspberry, i'm using Stain Phyton Editor.
Thank you, sir :')
Comments
I'm using this code (on attachment) that i got from this link: http://forums.parallax.com/showthread.php/154208-Basic-Stamp-serial-connection-Raspberry-Pi
I only change pin number.
i'm using Board of Education Develompment Board - USB, sir.
I was wondering the same thing.
I managed to blow out my PropBOE with a single terminal connector.
I now use heat shrink tubing over the 9V connectors on my boards.
BTW, In case any of you are unaware, the PropBOE has a lifetime warranty. (Even if you do something dumb to blow it up.)
No, Sir. On hardware, there is nothing problem. When i still using only basic stamp (coding from mac and only connect to mac), the LED is on. (i use the standard code like "High 15 Pause 1000")
And when i connect raspberry with Basic Stamp, and wanna turn on the LED from Raspberry, the LED cannot on. (in this case, i use the code from last thread. Look at the attachment. Hehe)
/dev/ttyUSB2 is the third USB to serial converter plugged in to your Raspberry Pi. If you only plug one in, it will be /dev/ttyUSB0
Umm, iits okay. Thank you, sir.
But, when i run the code, there is error. (on attachment)
What should i do? Is there any package that i must install? /
Try this!
Is your indentation right? Indentation matters in Python. Are you consistently using only spaces or only tabs?
wow! thank you, sir! i will try.
Aha! it was my fault. Now, my code can running. Thank you very much, sir.
But, sir. My raspberry pi still cannot turn on the LED. my LED is on the Basic Stamp 2. (so, i wanna turn on the LED from raspberry pi. In case, the LED is on the basic stamp)
In my code on SPE (attachment hehe), i think i must calling the function, isn't it? but i dont know what should i type. :/
To use code tags, start with [noparse] [/noparse]. This will allow your code to show up properly indented (or at least without the indentation changed my the forum software).
Without code tags, when you type (or paste) the following text it will not appear properly formatted.
____if value == '1':
______print ('LEDON')
______ser.write('2/n')
____elif value == '2':
The above indentation will not appear once the post is submitted. Instead of appearing indented as it does above, it will show up like the text below.
if value == '1':
print ('LEDON')
ser.write('2/n')
elif value == '2':
As you can see the indentation was lost.
However if you use code tags:
[noparse] [/noparse]
Then your code will appear as:
You should at least be able to cut and paste BS2 code this way. Getting the Python code from the RPi to the forum editor might not be as easy.
By sharing your code as text, we can then use the same code you are using without the need to type the code from the photos of the screens. I for one would be much more willing to test the code if I didn't have to manually type it into the program editors.
Oh, hehehe, im sorry, sir.
So, this is my BS2 Code.
and my SPE code:
That looks great. Thank you.
but, still doesn't works, sir. Led can't be on if i compile from Raspberry Pi. :/
Does the LED blink once quickly when you first turn on the BS2 board or reset the Stamp? It should with the code you're using.
yap. only once.
I wanna turn on if i press "1" button, and turn of if i press "2" button. But, it can't works. Are you know what should i do, sir? :/:/
But now we can try the code also. This should make it easier for others trying to help to find the problem.
Try this:
You are sending ASCII 49 or 50 ("1" or "2") but your code is expecting ASCII 1 or 2. If you do state = "x" instead of state = x, it should work.
ok, i will try, sir.
But for my code on raspberry pi (SPE), is there any false? Should i add new code or calling the function? Because, i wanna turn on the LED from raspberry pi (SPE).
You don't need to send /n, not to mention the fact that you probably meant \n if you want a newline. Just send "1" or "2" instead with no newline - it will be less stuff for the Stamp to process.
when i running on raspberry, still not works, sir. The LED which i put on Basic Stamp, cannot turn on.
The newlines seem unneeded and why not just use binary values instead of ASCII.
Using ASCII limits the program to 10 number values (0 to 9) for a 1 byte variable.
Not work sir.
am i must installing any software or package (maybe Pbasic) on raspberry pi? The LED doesn't works. If i push "1" button, it only show "LED ON" on the terminal, but the LED didn't on. -.-