I made an object named "mySerial" like this.
SoftwareSerial mySerial(2,3) //pin 2 = RX, pin 3 = TX
also I made pin 13 periodically(0.5 seconds) blink(HIGH/LOW), then the signal from pin 13 goes directly to pin 2 and pin 0(basic RX pin of UNO). I connected pin 0,2,13 directly with jumper wire.
and in the setup(), I wrote
Serial.begin(9600);
mySerial.begin(9600);
and in the loop(), I wrote
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
if(mySerial.available()){
mySerial.println("mySerial!");
}
if(Serial.available()){
Serial.println("Serial!");
}
when I compile this code and operate arduino, I can only see the "Serial!" on the serialmonitor. I think this means that the pin 0 can recognize the signal but the pin 2 cant' How can I solve this problem?
I can't find what I've missed. Please help me guys!
I connected pin 0,2,13 directly with jumper wire.
- why? You've lost me here. – Nick Gammon♦ Jan 18 '16 at 20:02