I am trying to get a GPS sensor (using Parallax BS2) to communicate with my arduino Mega 2560. To start with I am trying to send a simple, repetitive signal (eg. "10" or something) using serial (8N1) to the digital input of the arduino, and then print out the first 16 bits to see if I can find the pattern and isolate the stop bit etc... Here is my arduino code:
I can't figure out what the bits/second from the BS2 but I've included the BS code below the arduino code. I'm new to the whole programming word so please be gentle.
ARDUINO CODE
int BS2receive = 2;
int counter = 0;
void setup() {
Serial.begin(9600);
pinMode(BS2receive, INPUT);
}
void loop() {
// only do this 16 times
if (counter < 16) {
// read and print input
int inputState = digitalRead(BS2receive);
Serial.print(inputState);
counter++;
delay(1/19200); // delay in between reads to match with baud from BS2
}
else
{}
}
BASIC STAMP CODE
' {$STAMP BS2}
' {$PBASIC 2.0}
result VAR Word
Main:
SEROUT 0, 32,[0]
GOTO Main