Hello everyone I'm your friend JamesBin, this text allows you to learn from arduino 0 and 1, let's start learning!
Hardware
Source: Arduino-UNO-LED
Specifically includes the following:
Arduino UNO circuit board (1)
Mini breadboard (1)
220 ohm resistor (1)
the LED lamp (1)
Bread line (2)
Software only official Arduino IDE can be provided.
When you are ready to the above, as long as the next circuit connected, knocking a few simple lines of code, you can let the lamp flashes up!
Connecting circuit
int led = 13; // 定义针脚号,数字类型为整型
void setup() {
pinMode(led, OUTPUT);
}
// 系统调用,无限循环方法
void loop() {
digitalWrite(led, HIGH);
delay(1000);
// 此处向Arduino的13针脚发送低电压状态,
// 此状态可以让LED神灯熄灭
digitalWrite(led, LOW);
// 再次延迟1000毫秒,也即1秒钟,
delay(1000);
}