Skip to main content
3 of 3
added 6 characters in body
dda
  • 1.6k
  • 1
  • 12
  • 18
if(mySerial.available()>0)

mySerial.available() returns the number of bytes available in your serial receive buffer. Unless you are sending commands via serial in pins 8 and 9, this will remain 0 and you will never enter the if statement.

Also, you have two declarations for serial here:

  1. Serial.begin() initialized the built-in UART USB module. Here you will be able to send/receive commands with a program such as Putty.

  2. SoftwareSerial mySerial(8, 9); // RX, mySerial.begin() initializes serial communications with pins 8 and 9 on the Arduino board. This would be if you wanted to send/receive commands with digital I/O instead of, or in addition to, the UART USB module.