RS485 Serial communication difficulties

Hi, I have been having trouble with using RS485's to perform a master - slave serial communication. I am trying to get the value of a potentiometer to display on an lcd screen. the potentiometer is hooked up to the master, and the lcd screen is hooked up to the slave. When i look at the serial monitor for the master, i can see the potentiometer readings, but they aren't being translated to the slave. I am very knew to programming, so if there is any additional information you would need to help me out just let me know. Slave and master codes are both attached

master.ino (544 Bytes)

slave.ino (1.43 KB)

How is the RS-485 bus connected to your Arduino boards?

Do you see "CIRCUIT DIGEST" printed on the slave's LCD?

I'm using 2 arduino's and 2 RS485's. I have the RS485's connected to their respective arudino's with 'DI -> TX' 'RX -> RO' 'DE&RE -> 8' and I have the 'a' & 'b' ports of the rs485's connected

I've managed to get it to somewhat work since posting in this forum, but now the screen says 'PWM FROM MASTER 48' and won't change with the rotation of the potentiometer. I started the program with the potentiometer at '1023', but it still shows '48'.

Again, if there's any additional information you might need, just ask.

Thanks :slight_smile:

The way i got it to 'somewhat' work was just changing out an rs485. I didn't alter the code, as i can't see anything wrong with it

I'm using 2 arduino's and 2 RS485's.

Arduino UNOs?

You failed to post a link to that RS485's!

You failed to post a wiring diagram of your setup!

Serial.println(potval) will transfer an ASCII representation of your integer value (human readable string).

int pwmval = Serial.read();            //Receive INTEGER value from Master throught RS-485

That code does not what the comment says. It reads the first character of the transmission from the master!

I'm using an arduino uno as the master, and an arduino mega as the slave. I've attached the wiring setup, but i've switched the arduino nano with my mega. Do you have a suggestion on what i should change that line of code to?

And sorry for not adding a link the the RS485's i just don't know what that means :confused:

I've attached the wiring setup,

In which post? I cannot find a wiring diagram.

And sorry for not adding a link the the RS485's i just don't know what that means

It means you should add a link to the schematics of the hardware you're using! I know of at least a dozen boards that provide a RS485 to TTL interface and the differences between them may matter.

Do you have a suggestion on what i should change that line of code to?

I guess

int pwmval = Serial.parseIn();

might do the job but I cannot find an exact specification of your expectations in the existing posts.