RS485 ISSUES

Hi everyone,

I am working on a Piano project. I got two keyboards with 12 btns each running on 2 Arduino UNO.
the cord player is based on teensy 3.6 who play wave files from a builtin sd card. To communicate between the keyboards and the player I used RS485 based on MAX1487.

The RS487 working fine and I can read msgs from the two Arduinos.
On the keyboard’s side it looks like this :

void loop()
{
for (int i = 0; i < 12 ; i++) {

if (digitalRead(Pins_) == LOW && keyState == 1 )_
* mySerial.print((i+1)+KEB2); // mySerial goes to RS487 chip*

keyState = digitalRead(Pins*);*

* }*
* delay (100) ;*
}
*so I basically print the “i”+1+12 to rs485 port to get a wide of 24 commands. *
on the Teensy sid’s, I can read the incoming commands from the keyboards. on the serial monitor, it looks fine and I get complete numbers: 1 to 24. Next, I tried many data types to store the incoming data. when I try to do this, the values changed and I can’t restore correctly the original data that I sent. I used :
* data = Serial1.read(); *
* Serial.println(data);*
* delay(1000);*
when I print Data again(for debug) I get wrong values. I hope it’s clear :slight_smile:
I am looking for any ideas about how to control the player using RS487.
Thanks for the help ,
yinon

mySerial.printi think you should use mySerial.write()

THANKS, IT REALLY WORKS !!! :slight_smile: