Skip to content

Small optimization of sample sketch in Arduino Yun Guide #1862

Closed
@maghis

Description

@maghis

I noticed that running the sample sketch in the Arduino Yun guide in the "The Console" paragraph, the intel cpu is hogged by the bridge python script running at 95%.

A simple fix would be to add a small delay in the sketch:

void loop() {
  // see if there's incoming serial data:
  if (Console.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Console.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    } 
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
  delay(100);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions