I have a robot application on my Arduino which basically takes values from a SoftSerial instance on my 0/1 pins (connected to a Bluetooth board).

From the 'driver station' I send speed values to the Arduino through the aforementioned Bluetooth controller. The freezing happens when I compare the data (an integer) to a local integer (i.e 500). If I send the reverse command, I'm actually sending the int 500. If I compare my SoftSerial data like so:

if(softSerial.parseInt() == 500)

it freezes. It only happens when I'm using my SoftSerial stack over Bluetooth, over USB it doesn't freeze. What are my options?

  • Why are you using software serial on pins 0 and 1? Why not hardware serial? Apr 10 '15 at 19:51
  • @PeterR.Bloomfield would I have any issues uploading programs to my Arduino if I do? Apr 10 '15 at 20:59
  • freezes permanently or freezes for one second? does the BT message have a whitespace character after the 500?
    – BrettAM
    Apr 10 '15 at 21:14
  • @BrettAM freezes permanently. It doesn't, so maybe I should do a contains method? Apr 10 '15 at 21:51
  • @KeatonBurleson What you do with pins 0 and 1 when the program is running won't affect upload. The only potential issue is having something else physically connected to those pins while the upload is happening. It depends on the specific hardware though. Apr 11 '15 at 0:11

There is no point in using SoftwareSerial on pins 0 and 1, as you have HardwareSerial for that. Whatever the sketch does once it starts will not affect whether or not it uploads. If you have something connected to pins 0 and 1, during the upload, that may well stop the upload working, but what the sketch does afterwards does not.

It is hard to tell from your snippet, but if you also have activated HardwareSerial - eg. Serial.begin(9600); - then the hardware takes over those two pins and SoftwareSerial won't work anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.