Reading Serial (serout) from Basic Stamp

I have been working with Basic Stamp for many years.

One of my projects uses several Basic Stamp modules that communicate by looking at a looped serial string of 20 bytes. I am using RS232 and serial generated by a BS2 and a Max232. I use 38.4K baud.

For my first Arduino project I would like to look at a serial line that repeatedly sees a 20 byte string of data and be able to identify certain bits to control LEDs or Relays.

I don't have any problem with building the electronics part or making the connections.

I would love to find some sample code that does something similar or uses similar code. I need to assign a serial input pin, load an array and then use some logical function to identify certain bytes and values in the data. Then I need to operate some output registers connected to LEDs and RELAYs.

My prototype system uses the 74HC595 shift register as an output register, but I would be happy to be able to directly operate one of the many IO pins on the Arduino.

I am a quick learner and though I don't have C++ experience, I am quite good a pBasic as used on the Basic Stamp.

I thank anyone in advance if you can point me in the right direction.

BTW -- I have already built a prototype system using the Pro Mini and I am successfully programming and modifying BLINK. So I have at least successfully completed that hurdle.


Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

Make sure to convert RS232 signal levels to TTL before connecting to an Arduino.

An Arduino Micro, Leonardo or Mega might be the best choice because they have a spare HardwareSerial port that you could use to connect to your Stamp leaving the standard Serial port for debugging and uploading programs.


Thanks for the start..

And, as per your "signature" I will do some reading before asking my next question.


Serial Communications - MEGA2560 <–> Basic Stamp 2

*A 220 ohm resistor must be connected through the active data pin!!!

  1. Receiving from Basic Stamp
    -Baud = T9600 (Non- Inverted)
    -Arduino TX pin to GND
    -add delay(30); to Arduino code
    -add PAUSE 25 to Basic Stamp code

  2. Transmitting to Basic Stamp
    -Baud = T9600 (Non- Inverted)
    -Arduino RX pin to GND
    -add delay(50); to Arduino code
    -add PAUSE 10 to Basic Stamp code