Here i am attaching simple circuit for communicating two device over max485. i found below code seems work fine for some extent. during first time it read data, as soon as it complete read it start reading garbage value. Please let me know what are changes to be made in circuit to make it work.
I NEED TO COMMUNICATE DEVICE AS IN LAYOUT.
CONNECTION DIAGRAM REPRESENT ,PRESENT CONFIGURATION
master program-> Arduino1
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
Serial.write("Arduino write");
delay(1000);
}
Here i am attaching screen shot of output. Some time it keep reading same thing, how to overcome this problem.
Is there any mistake in connection diagram
ya , i made it working . Small changes made in circuit, I have added 120ohm resistor at both data lines
But i am facing another problem.
i have reverse the action , i.e Initially Arduino1 master and Arduino2 slave. changed to Arduino1 as slave and Arduino2 as master . This time i could able to receive data. Program syntax similar as pasted earlier
ya its working fine. I have attached output and code above.
SO i am trying these two things which are not working
1)interchanging master to slave and slave to master .and dumping code viceversa
2) communicate single master with two slave devices
here only one salve is receiving data , as soon u connected to 2nd slave start reading garbage value
I dont value what garbage value meant by. I am reading improper values like in communcation if ground is not properly connected you observe improper strings
i dont know what is meant by garbage value. According to me if output is reading improper strings i called it as garbage value.
i have attached output file here
According to me if output is reading improper strings i called it as garbage value.
According to you earlier in this thread, reading data that wasn't there (which you still appear to be doing from your screenshots) was "garbage", but is, in fact, completely normal and expected behaviour.
Sort that out, then post your code and your output.
out put file attached as below.
page1: without second slave connected. out put from Serial monitor slave1
page2: with both slave connected and changes in out put slave1
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
Serial.println("slave1 is running");// used in salve 1 program
Serial.println("slave 2 is running");// used in slave 2 program
String content = "";
char character;
while(Serial.available()) {
character = Serial.read();
content.concat(character);
}
Serial.println(content);
delay(1000);
}
Can I suggest you stop posting PDFs that don't open?
You're wasting my bandwidth.
Just cut and paste from your terminal window into a quote box.
Why are you using "String" in your receiver?
i tried to insert quote , But it didn't worked for me since i could not able to cut it from terminal window . i wanted put image but they are 2 mb file . SO i am putting PDF file.