my device is arduino uno and rs232 module.
i connect rx and tx rs232 module to arduino in pin 0 for rx and 1 for tx.
Asynchronous, bi-directional, half-duplex
Data format Baud rate: 1200, 2400, 4800, 9600 bps
Data: 7 bits + parity 1bit (even or odd) or 8 bits (non-parity)
Start bit: 1 bit
Stop bit: 1 bit
Code: ASCII
Terminator: CRLF (CR: 0Dh, LF: 0Ah)
This is a sample of the string generated:
S T , G S , + 0 0 1 2 . 3 4 5 gCR LF
If I open excel or notepad, data is continuosly written to application.
This is a sample of how the data is outputted:
ST,GS,+0012.345g
ST,GS,+0012.345g
ST,GS,+0012.345g
ST,GS,+0012.345g
The data is outputted about every 100ms
If I open a terminal emulator such as putty and connect at with the same vaules I'm attempting to use with my code, I see the same output.
I'm using the example code found in the arduino library. and the output in serial monitor is always -1 .
please help me!!
// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>#define rxPin 0
#define txPin 1// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);void setup() {
// define pin modes for tx, rx:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
Serial.begin(9600);
mySerial.begin(9600);
}void loop()
{
Serial.println(mySerial.read());
delay(500);
}