Home › Forums › Mayfly Data Logger › Using AltSoftSerial with Mayfly › Reply To: Using AltSoftSerial with Mayfly
2021-08-18 at 4:50 PM
#15838
Problem solved. As Sara has noted before, the AltSoftSerial can only use pin 6 on the Mayfly for receiving and pin 5 for transmitting. So, while the sketch worked with Software Serial as shown above (and would have worked by defining pin 6 for transmitting and pin 5 for receiving), my pairing of the sensor rx and tx wires to the Grove jack was wrong. See lines 17 and 18 above; I swapped the wiring from the sensor to the Grove jack and now get data from the sensor. This is what the portion of the sketch in question should look like to work with AltSoftSerial:
1 2 3 4 5 6 7 8 |
* white wire from RGB sensor to yellow Grove wire to D5 on Mayfly Grove connection * green wire from RGB sensor to white Grove wire to D6 on Mayfly Grove connection * ======================================================================= */ //#include <SoftwareSerial.h> //include the SoftwareSerial library #include <AltSoftSerial.h> //this is the alternative to SoftwareSerial #define rx 6 //define Mayfly pin 6 as the receive pin #define tx 5 //define Mayfly pin 5 as the transmit pin |