This seems so simple but I just can't get it to work.
I've tried buffers and subtracting '0' and looking for '/n' and about 100 other ways to get serial communication to work.
I've tried to use .print, .println, and .write. Nothing seems to work.
I simply am stuck.
So Please, any help.
Ok, I have 2 Uno R3s connected from pin2 to pin3.
All I want to do is send a number from one to the other.
here's my code on the sending station:
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial DirectConnect(2,3);
int i;
void setup()
{
Serial.begin(57600);
DirectConnect.begin(57600);
} // Setup
void loop()
{
for ( i = 1; i <= 100; i++)
{
DirectConnect.print(i);
Serial.println(i);
delay(50);
}
} // Loop
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial DirectConnect(2,3);
int RecVar;
void setup()
{
Serial.begin(57600);
DirectConnect.begin(57600);
} // Setup
void loop()
{
delay(50);
if(DirectConnect.available())
{
RecVar = DirectConnect.read();
Serial.println(RecVar);
}
} // Loop