Im using the ArduinoBT with the Parallax GPS module.
I'm powering the board with just one 1.5V battery at the moment.
I wrote a small program to test if I can read the NMEA strings. The program checks if I can get the first character of the NMEA string ( first character = $). The GreenLed (pin 13) will turn on when the first character of the string is $, otherwise the RedLed(pin 12) is on.
The code is below:
#include <ctype.h>
#include <string.h>
int ledPinRed = 12; //Led-On = if I dont get the $ char
int ledPinGreen = 13; //Led-On = If I get the $
int rxPin = 0; //Serial Communication Pin Rx (Receive)
int txPin = 1; //Serial Communication Pin Tx (Transmit)
char buffer;
int incomingByte=-1;
char check='
Im new at this and I have a few questions:
First of all, is my code ok?
Do you think the 1.5V supply is the reason my gps module doesnt seem to work? The "low-battery" led on the board is always on.
Should I use the NewSoftSerial Library for the communication?
I wonder if the board can get serial data, in my code with the SerialRead function.; //The first Valid Char of a NMEA string
void setup()
{
Serial.begin(4800);
pinMode(ledPinRed,OUTPUT);
pinMode(ledPinGreen,OUTPUT);
pinMode(rxPin,INPUT);
pinMode(txPin,OUTPUT);
}
void loop()
{
digitalWrite(ledPinRed, HIGH);
digitalWrite(ledPinGreen, LOW);
incomingByte=Serial.read();
if (incomingByte == -1){
delay(100);
}
else{
if(incomingByte == check){
digitalWrite(ledPinRed, LOW);
digitalWrite(ledPinGreen, HIGH);
delay(5000);
}
}
}
Im new at this and I have a few questions:
First of all, is my code ok?
Do you think the 1.5V supply is the reason my gps module doesnt seem to work? The "low-battery" led on the board is always on.
Should I use the NewSoftSerial Library for the communication?
I wonder if the board can get serial data, in my code with the SerialRead function.