sweep-arduino icon indicating copy to clipboard operation
sweep-arduino copied to clipboard

Inconsistent behavior when using SoftwareSerial

Open Tsukinara opened this issue 7 years ago • 0 comments

Hello!

I am currently using an Arduino Nano (ATmega328P) to work with the Sweep, which only has a single set of RX and TX pins. Because of this, I am using Arduino's SoftwareSerial library to communicate with the sensor.

I have been using the example MegaSerialPrinter for testing, with the modifications of (1) using a SoftwareSerial stream instead of Serial1, and (2) continuously printing readings instead of collecting full revolutions first. However, although I am able to set the motor settings and get device information without a problem, I am unable to get readings from the sensor, as getReading returns false.

Oddly, this issue occurs intermittently, and the program behaves perfectly as expected roughly 10% of the time. However, upon resetting, all calls to getReading fail, and no data can be read. I have confirmed that the isScanning is true when getReading is called, and that the firmware is up to date. I have attached the code I am using to test, if it is relevant. scanse_test.zip

Thanks!

Tsukinara avatar Feb 23 '18 02:02 Tsukinara