跳到主要内容

Lesson 3: Names and variables

English

Give pins a name

  • const int LED = 13; gives pin 13 a name. const means it never changes.
  • Now the code says what the pin is for. To move the LED to another pin, you change one line.
const int LED = 13;

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(200);
  digitalWrite(LED, LOW);
  delay(800);
}

登录或创建账户

IGCSE, A-Level & AP