特色灯 — Arduino Mega simulation

An interactive Arduino Mega circuit simulation you can run free in your browser on Velxio, by bxxbx.

Components

Sketch code

// Arduino Mega 2560 — Blink LED
#define PINNUM 12
const int PINLED[12]={0,1,2,3,4,5,6,7,8,9,10,11};
void setup() {
  for(int i=0;i<12;i++)
    pinMode(PINLED[i], OUTPUT);
 
}

void loop() {
  for (int i = 0; i < 12; i++) {
    digitalWrite(PINLED[i], HIGH);
    delay(200);
    digitalWrite(PINLED[i], LOW);
    delay(10);
  }
  for (int i = 0; i < 12; i--) {
    digitalWrite(PINLED[i+6],HIGH);
    delay(200);
    digitalWrite(PINLED[i+6], LOW);
    delay(10);
  }
  
}

More projects by bxxbx