全彩LED — 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 — 全彩LED灯
//引脚数量为3
#define PINNUM 3
//定义引脚常数组
const int PINLED[3]={11,13,12};
void setup() {
  //循环
  for(int i=0;i<3;i++){
    pinMode(PINLED[i], OUTPUT);
  }
}

void loop() {
  for(int i=0;i<3;i++){
    digitalWrite(PINLED[i], LOW);
    delay(1000);
    digitalWrite(PINLED[i], HIGH);
    delay(20);
  }
  
}

More projects by bxxbx