极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 15977|回复: 4

Anduino第一个led实验求指点

[复制链接]
发表于 2021-9-1 10:55:50 | 显示全部楼层 |阅读模式

  1. int led =13;

  2. void setup() {
  3.   // put your setup code here, to run once:
  4.     pinMode(LED_BUILTIN, OUTPUT);
  5. }

  6. void loop() {
  7.   // put your main code here, to run repeatedly:
  8.     digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  9.   delay(1000);                       // wait for a second
  10.   digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  11.   delay(1000);  
  12. }
复制代码

但是这样变异上传后灯不亮 求指导啥原因。


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

发表于 2021-9-3 08:59:37 | 显示全部楼层
int led =13;

void setup() {
  // put your setup code here, to run once:
    pinMode(led, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
}
回复 支持 1 反对 0

使用道具 举报

发表于 2021-9-1 19:09:08 | 显示全部楼层
目测没接通
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-9-3 16:33:12 | 显示全部楼层

哪个位置接线有问题呀?
回复 支持 反对

使用道具 举报

发表于 2021-10-2 18:33:16 | 显示全部楼层
int led =13;
pinMode(LED_BUILTIN, OUTPUT);
问题出在这两句, 引脚指定用的变量名 led , 函数里用的 LED_BUILTIN 。 楼上已经有人帮你改好了,不去试试?

还有就这个实验而言,直接插UNO上就行了,不用面包板和电阻,放心烧不了的。至于为什么,本论坛实验摸爬滚打搞几十个自然明白了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-20 16:15 , Processed in 0.040963 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表