1

I have my arduino connected to my PC and another serial device. This serial device sends a 3 line piece of info on bootup then if I trip a zone it will send information regarding the radio transmission.

When I first power up the device I see the information from the device in the serial monitor (SELFTEST-PASS) however that is the last information I receive from it until I powercycle the device.

I have connected it directly to my PC comport and verified information is being sent via Serial however the arduino seems to quit after the first bit of info... any idea where to proceed from here? PS I have tried both SoftwareSerial and NewSoftSerial
Here is an example of the data sent from the serial device as viewed by hyperterminal:

<1234 #3F->0000 1234->FFFF D_ALARM>
<FFFF #3F->1234 FFFF->1234 P_ACK>
<1234 #40->0000 1234->FFFF D_ZREST>

Code that is currently not working:

 #include <AltSoftSerial.h>
 AltSoftSerial portOne;

void setup() {


                Serial.begin(4800);
                while (!Serial) {; // wait for serial port to connect. Needed for native USB port only
                }
                // Start each software serial port
                portOne.begin(4800);

              }

// the loop function runs over and over again forever
void loop() 
{
  if (portOne.available())
  {
    Serial.write(portOne.read());
  }

  if (Serial.available())
  {
    portOne.write(Serial.read());
  }
}
4
  • What pin do you have the device connected to on the Arduino? What Arduino do you have? What baud rate do you have set in the Serial Monitor?
    – Nick Gammon
    Commented Mar 5, 2016 at 20:38
  • 8,9 - uno 4800. When I first power up unit is see the self test but nothing further. I have connected directly to a pic and verified the radio I'm connecting to does indeed continue to send data.
    – Tony M
    Commented Mar 6, 2016 at 2:34
  • Which is Rx and which is Tx?
    – Nick Gammon
    Commented Mar 6, 2016 at 3:08
  • One way displayed junk when I booted up the device so I swapped the pins and that showed me the bootup message. 9=tx 8=rx
    – Tony M
    Commented Mar 7, 2016 at 13:21

2 Answers 2

0

Try SoftwareSerial rather than AltSoftSerial.

I don't see the point in these lines, I think you can remove them:

 if (Serial.available())
  {
    portOne.write(Serial.read());
  }

I have connected directly to a pic and verified the radio I'm connecting to does indeed continue to send data.

If that is the case, that it sends data anyway, then you could just use HardwareSerial. Connect the radio to Rx (D0 on the Uno) and leave Tx unconnected. Then just read from Serial, and write to Serial. You should see the results on the Serial Monitor. (Disconnect this wire when uploading new versions of the sketch).

12
  • Thank you for the information Nick, in my original post I stated I had tried both SoftwareSerial and AltSoftSerial. Also I believe the snippet of code you specified allows me to send a character from the serial monitor to the serial device hooked up to the software serial port... Yes?
    – Tony M
    Commented Mar 5, 2016 at 15:03
  • Yes, but does the device need to receive data?
    – Nick Gammon
    Commented Mar 5, 2016 at 20:38
  • I can trigger a response from the radio but sending a character to it. However I am not seeing anything after the initial boot up message. I can connect directly to of serial and interact np, but the arguing only gives me the initial power up message.
    – Tony M
    Commented Mar 6, 2016 at 2:31
  • See amended answer.
    – Nick Gammon
    Commented Mar 7, 2016 at 19:57
  • Now I'm totally stumped.
    – Tony M
    Commented Mar 7, 2016 at 20:31
0

Device connected to arduino had DTR/DSR. I had to jumper one to the other to convince it to flow data to the arduino.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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