- Wed May 12, 2010 7:58 am
#100756
Hi all!
- I am having a weird problem with the OpenLog. When connected directly to a hardware-based serial (for example RX/TX-Pins 0/1 at an Arduino) I can easily use the logger.
However, when I connect the logger instead to some other digital pins, say Arduino pins 3&4, and use the NewSoftSerial-library, I get transmission errors (I issued a "?" after the prompt, later a "ls" to test transmission):
The code I am using on the Arduino is very simple:
Any help would be appreciated!
cpix
- I am having a weird problem with the OpenLog. When connected directly to a hardware-based serial (for example RX/TX-Pins 0/1 at an Arduino) I can easily use the logger.
However, when I connect the logger instead to some other digital pins, say Arduino pins 3&4, and use the NewSoftSerial-library, I get transmission errors (I issued a "?" after the prompt, later a "ls" to test transmission):
>?Clearly, not all characters are transmitted properly. Seems to start out well and to fail later in the sequence... .
OpenLog 1.61
Available cmmands:
new <file> : Creates <filAf sod6st e et:e
eldn cnoSfo ie etfrhonite
ioSryeiemEdo f tt
>
>ls
CONFIG.txt 12
>
The code I am using on the Arduino is very simple:
Code: Select all
- am I missing here something in my program? Or is the problem here caused by speed mismatches between the Arduino and OpenLog? #include <NewSoftSerial.h>
NewSoftSerial mySerial(2, 3);
int state = 0;
void toggle_LED()
{
if( state==0 )
{
digitalWrite(13,HIGH);
state = 1;
}
else
{
digitalWrite(13,LOW);
state = 0;
}
}
void setup()
{
Serial.begin(57600);
mySerial.begin(9600);
pinMode(13,OUTPUT);
}
void loop()
{
if (mySerial.available())
{
char c = mySerial.read();
if( c=='\r')
Serial.println( c,BYTE );
else
Serial.print( c,BYTE );
}
if (Serial.available())
{
toggle_LED();
char c = Serial.read();
if( c=='\r')
mySerial.println( c,BYTE );
else
mySerial.print( c,BYTE );
}
}
Any help would be appreciated!
cpix