Use SoftwareSerial.h or NewSoftwareSerial.h
I can is it 1/4 speed low, we can skip 3 cycle and send 1
Use SoftwareSerial.h or NewSoftwareSerial.h
I can is it 1/4 speed low, we can skip 3 cycle and send 1
Using the same serial port?
You would have to change speeds on the fly:
Serial.begin (4800);
// receive data
Serial.end (4800); // ?? need 4800 here?
// then
Serial.begin (1200);
// send data
Serial.end (1200); // ?? need 1200 here?
This is because the data is sampled as it comes, timing is used after the start bit to find the miiddle of the bits to decide if a bit is 1 or 0.
then get unbalanced data
Please explain what you are trying to do. You can only have one device attached to a serial port at a time, and it is unlikely that one device has different read and write speeds.
You can use NewSoftSerial to create a software serial port, and run the software serial port at one speed, while running the hardware serial port at another.
Whether this will cause problems, or not, depends on whether the incoming (faster) speed data is a continuous stream, or if there are (significant) idle periods where the output process can catch up.
I'm not the original poster, but...
You can only have one device attached to a serial port at a time
.
Not exactly. I have a rig that uses the TX side of the arduino's hardware serial port for one device, and the RX side for a different device. Conveniently, both my devices could run at the same speed.
I agree with donix, sounds like putting one of them on a NSS port would be a good solution.
-j
PaulS> then i gen gps data witch speed 4800 i try put in the buffer and transmit. GPS data
I rx data via hardware serial port 0
int GPSrxPin = 0; // RX PIN
int byteGPS;
int buffer;
sendSerial = NewSoftwareSerial(2, 3);
Serial.begin(4800); //speed transmit usb to pc
sendSerial.begin(1200); //speed send
buffer?
buffe=byteGPS
sendSerial.print(buffer,BYTE);
or use buffering
for (int i=0; i<0; ++i)
{
byteGPS=serial.read();
}
for (int i=0;i<0;i++)
{
sendSerial.print(byteGPS,BYTE);
}
Were you intending to pass the data along as it came in?
If so, maybe more like this:
if (Serial.available()>0){ // << check that data is there to be read first
byteGPS = ( serial.Read() ); // read it
sendSerial.print( byteGPS, BYTE ); // send it
}
Or maybe even combine that??
if (Serial.available()>0){
sendSerial.print( serial.Read(), BYTE );
}
turn of TXEN0 and then attach NewSoftSerial to the TX pin