2 Replies Latest reply on Oct 15, 2013 6:34 AM by eontap

    Serial.print not working in setup() but working in loop()

    eontap

      I was getting ready to test a CAN bus shield on Galileo when I noticed that Serial.print()  does not seem to be working when invoked from the setup() function. The Serial.begin() call seems to be in the correct position - see code below.

      Any particular reason for Serial.print() not to work in the setup() function on Galileo ? The same code works as expected on the MEGA 2560. I could not see anything specific in the release notes that apply to this behavior. Any ideas ?

       

       

      /*
        Blink
      Turns on an LED on for one second, then off for one second, repeatedly.

      This example code is in the public domain.
      */

      // Pin 13 has an LED connected on most Arduino boards.
      // give it a name:
      int led = 13;

      // the setup routine runs once when you press reset:
      void setup() {               
        // initialize the digital pin as an output.
        Serial.begin(9600);
        pinMode(led, OUTPUT);  
        Serial.println ("Hello LED - SETUP");

      }

      // the loop routine runs over and over again forever:
      void loop() {
        digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(500);
        Serial.println ("Hello LED - LOOP"); 
        // wait for a second
        digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
        delay(500);               // wait for a second
      }