![]() This seemed to help drive the point home for me. I went back to an XBee tutorial that used similar code (see bottom of post). set the data rate for the SoftwareSerial port Open serial communications and wait for port to open: SoftwareSerial mySerial(10, 11) // RX, TX The code from that example is copied below: That makes it sounds like I don't need anything connected on the other end. Make sure that your Arduino or Genuino board is attached to your computer via USB to enable serial communication through the serial monitor window of the Arduino Software (IDE)." I saw another example here which uses similar code,, and it says: If you want to be able to see what SoftwareSerial write()s then you need something connecting pins 2 and 3 to another USB port on your PC - for example a USB-TTL cable. ![]() monitor? Instead it looks like we’re sending it right buffer, why wouldn’t we display it to the serial something and it’s sitting in the serial receive MySerial.write(Serial.read()) //If yes, read what is in the serial buffer, and on Pin 2 which is now waiting in the serial port receive has the object transmitted something that was received If (Serial.available()) //Is there data waiting in the receive buffer of the serial port? Serial.write(mySerial.read()) //If yes, read the data going to the object and typed something into the serial monitor and transmitted If (mySerial.available()) //Has the mySerial object received something? (i.e. Serial.begin(9600) //Open the serial port for communication MySerial.begin(9600) //Open the mySerial port for communication We will transmit to the object using Pin 3 and receive #include //Include the SoftwareSerial library I attempted to comment on the sketch below to illustrate how I understand the statements, but please correct my comments if I’ve misunderstood a concept. (Additionally, if I had a device hooked up that was sending responses, this sketch would display the responses to the serial monitor, but I’m not doing that yet.) From my understanding, I should be able to connect by USB to the Arduino, load this sketch, and then whatever I type in the Arduino IDE serial monitor should get echoed back to me. I’ve seen a couple examples very similar to the one below (originally seen in this discussion, Sending AT commands through serial monitor - Programming Questions - Arduino Forum), but I can’t get it to work. However I'm having some trouble understanding the basics, even after going through some of the easy examples I found online. I'm attempting to learn about serial communications, particularly how to use SoftwareSerial on a Sparkfun Redboard (Arduino Uno). I’ve highlighted specific questions and pleas for help in red Thanks in advance to anyone who has the patience to read all of this and help me learn.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |