Hello,
I have a project needs more serial ports to achieve input and output signals,
but, I use the board of Arduino Uno R3, not Arduino Mega 2560.
Arduino Uno just only have one serial communication,
so I try used AltSoftSerial Library (AltSoftSerial Library, for an extra serial port) to build more visual serial ports.
Unfortunately, there are some problems occur.
It is just a sample code I depict the situation without connecting any external device...
#include <AltSoftSerial.h>
AltSoftSerial altSerial(8, 9);
void setup()
{
Serial.begin(9600);
Serial.println("Hello Serial");
altSerial.begin(9600);
altSerial.println("Hello AltSerial");
}
void loop()
{
char c_serial, c_altserial;
// Write it.
c_serial = Serial.read();
Serial.print("Write it to Serial: ");
Serial.println(c_serial);
altSerial.print("Write it to AltSerial: ");
altSerial.println(c_serial);
// Read it.
c_altserial = altSerial.read();
Serial.print("Read it from AltSerial: ");
Serial.println(c_altserial);
delay(10000);
}
In the serial monitor, the result is ...
Hello Serial
Write it to Serial: ÿ
Read it from AltSerial: ÿ
The message can be printed from serial port,
but there is nothing from AltSoftSerial (can not print out the value I need).
My environment of development is Arduino IDE 1.0.5, and I use Arduino Uno R3.
Is there any suggestion? Thanks a lot!!