【Beetle ESP32 C6迷你开发板】--2.点亮LED
<div class='showpostmsg'><p> 本篇讲述驱动点亮开发板LED.</p><p>一.了解原理</p>
<p> 用户LED由ESP32-C6-FH4的GPIO15引脚控制,高电平点亮。原理图如下</p>
<div style="text-align: center;"></div>
<div style="text-align: center;">图1:LED原理</div>
<p>二.Arduino IDE配置与代码准备烧录运行</p>
<p>1.IDE配置</p>
<p> Arduino IDE需按要求选择合适配置,否则编译烧录不进开发板。</p>
<p>Board选择:Tools->Board->esp32->DFRobot FireBeetle 2 ESP32-C6</p>
<p>USB CDC On Boot选择Enabled</p>
<p>选择Port开发板端口即COM口</p>
<p>磁盘分区Partition Scheme,根据开发板Flash选择合适的存储空间,这里默认</p>
<div style="text-align: center;"></div>
<div style="text-align: center;">图2:Arduino IDE配置</div>
<p>2.代码</p>
<p> 打开File-->Examples->01.Basics-->Blink并另存为。代码修改如下</p>
<pre>
<code>int LED=15;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
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); // wait for a second
}
</code></pre>
<p>3.编译烧录</p>
<p>点击Sketch-->Verify/Complie编译,点击Sketch-->Upload烧录。</p>
<div style="text-align: center;"></div>
<div style="text-align: center;">图3:编译烧录</div>
<p>4.运行</p>
<p> 烧录后可看到蓝色LED1灯1s间隔闪烁,达到预期。</p>
<div style="text-align: center;"></div>
<div style="text-align: center;">图4:LED闪烁</div>
<p> </p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>烧录后可看到蓝色LED1灯1s间隔闪烁,达到预期,完美</p>
Jacktang 发表于 2024-5-12 08:53
烧录后可看到蓝色LED1灯1s间隔闪烁,达到预期,完美
<p>是的,全工具链 开发板功能跑起来了</p>
<p></p>
<p>赞zzzzzzzzzzzzzzzzzzzzzzzzzzzzz</p>
页:
[1]