Basic Stamp 1 or 2 & REALBasic?
martintelefont
Posts: 9
Hi
I was wondering if anybody has any experience with making REALBasic talk to the Stamps? Anybody? I already asked at the REALBasic forum and got zip. So I thought I try the other end of the spectrum. I got a program running that looks like this:
and this in REALBasic
anybody know why it won't blink?
I was wondering if anybody has any experience with making REALBasic talk to the Stamps? Anybody? I already asked at the REALBasic forum and got zip. So I thought I try the other end of the spectrum. I got a program running that looks like this:
' {$STAMP BS2} ' {$PBASIC 2.5} val VAR Byte val = 1 DO DEBUGIN STR val \1 IF val = "1" THEN LOW 15 PAUSE 200 HIGH 15 PAUSE 200 LOW 15 DEBUG "blinked" ENDIF IF val = "2" THEN DEBUG "didn't blink" ENDIF LOOP
and this in REALBasic
dim a as Integer = System.SerialPortCount Listbox1.DeleteAllRows for i as Integer = 0 to a-1 Serial1.SerialPort=System.SerialPort(i)//= in my case "COM5" if serial1.open then serial1.Write("1") else MsgBox "The serial port could not be opened." Listbox1.AddRow system.SerialPort(i).Name+" done" next
anybody know why it won't blink?
Comments
First of all you are quick, wow, 2 posts in 2 days and you are the first to respond to both, cudos.
well I tried that with both 9600 and 19200 and still no blinking. Yes I checked the wiring and I do get blinking if I send the signal out of the stamp environement.
Did you load the Stamp program with the Parallax IDE? if you did so without error, can you enter a "1" manually in the upper pane? If so, the problem lies somewhere within the PC (port parameters, REALBasic code, COM port number, etc.) If not, then the issue is probably external to the PC (Stamp code, cable, USB-serial adapter, etc.)
Just my two cents,
Terry
I ran the whole thing out of the parallax program and 1 in the debugger window will make the LED flash and give me back the text and everything. And I know the RB code works up to the point where it opens the port. I just have no idea where the message gets lost after that.
I know that this can be done in Linux, but it is much harder to access (or it is for me, anyway) to do so in Windows...
Have fun,
Terry
On another front. I found an article by Chris McAvoy "how I Feed my cats with linux". Well I tried to install the PySerial that he uses to talk to the Stamp and well I am not getting anywhere. Is it a Win problem or a the piece is some 4 years old problem?
Here is the error:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [noparse][[/noparse]MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.2.1
>>> import serial
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import serial
File "C:\Python25\lib\site-packages\serial\__init__.py", line 13, in <module>
from serialwin32 import *
File "C:\Python25\lib\site-packages\serial\serialwin32.py", line 9, in <module>
import win32file # The base COM port and file IO functions.
ImportError: No module named win32file
>>> sp = serial.Serial(0)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
sp = serial.Serial(0)
NameError: name 'serial' is not defined
Sorry, I have NO experience with Python. I can tell you that Microsoft tends to put its own tweaks on other languages, and then tries to call them "standard". At one time it used to be quite to use the serial ports in Liberty Basic, but I don't know if Liberty will even load under WinXP... The last time that I tried to do anything with serial ports on Windows, I discovered that I had to run Hyperterm first, and set the port parameters that way. No matter what I did in Perl, C, or C++, some lower level driver or wrapper wouldn't recognize the parameters, except by way of Hyperterm.
Now, that's a thought; go into Hyperterm, set the port parameters, (send your "1" just for grins), close Hyperterm and try your REALBasic program. It's not good, it's not acceptable, but it would tell you where the trouble lies...
Regards,
Terry
Terry