I just got myself an Arduino Yún, and I decided I'd take it out for a spin...
So far I've had nothing but trouble with it, and one of the most annoying of these troubles is this:
I upload a sketch, and then I wait, and wait, and wait, and wait
It's been 5 minutes since I uploaded the sketch and the Serial connection is STILL not ready (I made a while(!Serial) in the setup function that blinks the pin 13 led to see when it'd finish)
What's worse is that every time I reupload the sketch either the same thing happens, or it starts working after like a minute, sometimes it takes a minute for it to even START blinking
Is there anything I can do to possibly fix this? (10 minutes now, still blinking)
Some notes:
I did connect it to the internet, which all went smooth
The first sketch I tried to upload to it caused my computer to restart (think that might have something to do with it?)
It takes 5-8 re-uploads to make it work...
The Yún reset button does nothing
The Yún doesn't automatically execute the sketch when I reconnect the power
UPDATE
2 new discoveries have been made
sometimes it starts the serial connection when I open the serial monitor (which it technically shouldn't)
and sometimes it doesn't start looking for serial at all
it's a slightly modified version of the HTTPClient sketch
/*
Yun HTTP Client
This example for the Arduino Yún shows how create a basic
HTTP client that connects to the internet and downloads
content. In this case, you'll connect to the Arduino
website and download a version of the logo as ASCII text.
created by Tom igoe
May 2013
This example code is in the public domain.
http://arduino.cc/en/Tutorial/HttpClient
*/
#include <Bridge.h>
#include <HttpClient.h>
void setup() {
// Bridge takes about two seconds to start up
// it can be helpful to use the on-board LED
// as an indicator for when it has initialized
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
Serial.begin(9600);
while (!Serial) {
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
} // wait for a serial connection
digitalWrite(13, HIGH);
}
void loop() {
// Initialize the client library
HttpClient client;
// Make a HTTP request:
client.get("https://status.github.com/api/last-message.json"); // this part doesn't even work at all
// if there are incoming bytes available
// from the server, read them and print them:
Serial.print("Connecting...\n");
while (client.available()) {
char c = client.read();
Serial.print(c);
}
Serial.flush();
delay(500);
}
I'm not sure if we have the same issue or not. When I use my yun with the serial terminal, I have to open the serial monitor to start the sketch. If I run the sketch without being connected to a computer, I have to comment out the while(!serial) part or the sketch never runs. I am new to the yun/Leonardo so there maybe a better way of doing it. I also notice it seems to take a second to start up the wifi and the light only comes on if I hit the reset button.
whiteglint143:
I have to comment out the while(!serial) part or the sketch never runs.
Yes, that's the intended behaviour. It let's you open the serial monitor before your sketch runs, so you don't miss any debug output
Same goes for while(!Console) if you're using Console (wifi serial monitor) instead of Serial (usb serial monitor)