Arduino-Hello World

网友投稿 2020-01-01 11:03

一、hello world(串口通信)

1、Mixly编程

https://cdn.china-scratch.com/timg/200103/1103064427-0.jpg

2、Arduino IDE编程

void setup() {// put your setup code here, to run once:Serial.begin(9600); //初始化串口并设置波特率为9600}
void loop() {// put your main code here, to run repeatedly:Serial.println("Hello World!"); //打印Hello World!并回车换行delay(1000); //延时等待1s}

二、UNO板Led闪烁(13号管脚)

1、Mixly编程

https://cdn.china-scratch.com/timg/200103/11030L1Z-1.jpg

2、Arduino IDE编程

void setup() {pinMode(led, OUTPUT); //将"led"引脚设置为输出状态}void loop() {digitalWrite(13, HIGH); //引脚输出高电平1,点亮LEDdelay(1000); //等待1sdigitalWrite(13, LOW); //引脚输出低电平0,熄灭LEDdelay(1000); //等待1s}

声明:本文章由网友投稿作为教育分享用途,如有侵权原作者可通过邮件及时和我们联系删除:freemanzk@qq.com