MikkoP
MikkoP

Reputation: 5092

Reading serial data from Arduino fails

I have written a program for Arduino that reads some analog signals and sends them to the computer when it receives a command from the master computer. I wondered why this didn't work on the computer it was intended to run on. On my own computer it runs fine.

I uploaded a simple test code in the Arduino.

void setup() {
    Serial.begin(9600);
}

void loop() {
    if(Serial.available()) {
        Serial.println(Serial.read());
    }
}

This doesn't run on the second computer either. When I use Arduino serial monitor for transfering data, I see the RX led blink but not the TX. With the computer it's working on, I can see both of the leds flash. Arduino receives the data on both computers, but the second computer doesn't receive Arduino's responses. What might be wrong?

Edit. I forgot the Arduino hooked up to the problematic PC for a few minutes and tried it again. Then it worked! It seems like it needed some time to warm up. Why's that?

Upvotes: 0

Views: 613

Answers (1)

Steven Petryk
Steven Petryk

Reputation: 683

Sometimes it can take a second for the Arduino and computer to establish the Serial handshake, especially at 9600 baud. I'm glad you got it working!

Upvotes: 0

Related Questions