I'm trying to send the ASCii character codes 254 and 8 through Arduino Mega to a relay (more later, but for now just those two in that order). The relay is a R410pro.
The relay works when receiving data from a C sharp program. However, I am struggling to send the ASCii codes from the Arduino to the Relay and getting a response. As of now, it is doing nothing.
It seems as though I am missing something as the Arduino will talk through Serial1 to another computer correctlly, just not the relay. I've switched the TX/RX to see it that's wrong, no luck.
I've tried this...
void setup()
{
Serial.begin(9600); //pins 1 and 0 for Serial
Serial1.begin(9600);
}
unsigned char thisByte = 254;
unsigned char nextByte = 8;
void loop()
{
Serial1.print(thisByte, BIN);
Serial1.print(nextByte, BIN);
if (Serial1.available()>0){
Serial.print("Relay Serial is recieving data"); //nothing ever comes back
}
delay(10);
}
and this....
void setup()
{
Serial.begin(9600); //pins 1 and 0 for Serial
Serial1.begin(9600);
}
byte thisByte = 254;
byte nextByte = 8;
void loop()
{
Serial1.print(thisByte, BIN);
Serial1.print(nextByte, BIN);
if (Serial1.available()>0){
Serial.print("Relay Serial is recieving data"); //nothing ever comes back
}
delay(10);
}
and this...
void setup()
{
Serial.begin(9600); //pins 1 and 0 for Serial
Serial1.begin(9600);
}
int a = B11111110;
int b = B00001000;
void loop()
{
Serial1.write(a);
Serial1.write(b);
if (Serial1.available()>0){
Serial.print("Relay Serial is recieving data"); //nothing ever comes back
}
delay(10);
}
but nothing happens to the relay.
Any help would be great.