blink
硬件连接
项目创建
按4.2.3节创建项目。
编写代码
示例-main.cpp
1/*
2 Blink
3 Turns an LED on for one second, then off for one second, repeatedly.
4*/
5
6#include <Arduino.h>
7
8#define LED_BUILTIN 47 // Define the built-in LED pin, usually pin 13 on most boards
9
10void setup() {
11 // Initialize digital pin LED_BUILTIN as an output.
12 pinMode(LED_BUILTIN, OUTPUT);
13}
14
15void loop() {
16 digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on
17 delay(1000); // Wait for a second
18 digitalWrite(LED_BUILTIN, LOW); // Turn the LED off
19 delay(1000); // Wait for a second
20}
编译并上传
代码上传后,掌控板会自动运行代码,LED会闪烁。