I am using an Arduino Uno board with IDE 1.6.7.
I have tried to implement a tweaked version of the basic example (SoftwareSerial example) from the Software Serial library. The code is attached.
It should blink the light and print the message on the serial monitor. But I am not getting anything.
In fact, I also tried the example as it is. It did not work either.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9); // RX, TX
void setup() {
pinMode(13,OUTPUT);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
delay(1000);
}
void loop() { // run over and over
mySerial.println("hell");
if (mySerial.available() > 0) {
digitalWrite(13,HIGH);
Serial.write("working..");
delay(3000);
digitalWrite(13,LOW);
delay(2000);
}
}
Just connect pin 8 and 9 so that the data you sent through pin 9 will be received in Rx and satisfies the if condition.
If this works, the problem is with your device connected to soft Rx
– Sanu - Open Maker Apr 30 '17 at 13:52