可以有两个独立的LED吗?

huangapple go评论86阅读模式
英文:

Can I have two independent LEDs?

问题

使用 V1 微:比特,是否可以拥有两个独立的LED?我希望一个像心跳一样(每秒闪烁一次),另一个用于指示,例如,是/否。

无论我尝试了哪些配对,当我选择的两个LED都亮起时,其他LED都会亮起,这很不美观!

英文:

Using a V1 micro:bit, is it possible to have two independent LEDs? I want one to act as a heartbeat (flash once a second), the other to indicate, for example, go/nogo.

Whatever pairings I’ve tried, other LEDs come on when both of my chosen LEDs are on, which is ugly!

答案1

得分: 1

我被 '标准' LED 控制示例中同时操作 '行' 和 '列' GPIO 的方式误导了。

中央LED位于外部位置 (3, 3),左下角位于 (5, 1),分别对应 GPIOs (r2, c3) 和 (r3, c3)。如果我将左下角作为心跳指示,那么每当我关闭它 (c3 设为高电平) 时,也会同时关闭 (3, 3)。

解决方案(对我的问题而言,几乎不是通用解决方案)是将 c3 永久设置为低电平,并分别使用 r2 和 r3 控制这两个LED。

我还可以使用右上角的按钮 (1, 5) => (r1, c3)。

或者,为了有更多选择,将 r1 永久设置为高电平,并使用 c1 到 c9 进行控制。

英文:

I was misled by the way the 'standard' examples of LED control manipulate both the 'row' and 'column' GPIOs.

The central LED is at external position (3, 3), and the bottom left at (5, 1), which correspond to GPIOs (r2, c3) and (r3, c3) respectively. If I use the bottom left as the heartbeat, then whenever I switch it off (c3 set high) I’ll also switch (3, 3) off.

The answer (to my problem: hardly a general-purpose solution) is to leave c3 set low permanently and control the two LEDs using r2 and r3 respectively.

I could use the top right button (1, 5) => (r1, c3) as well.

Or, for more choice, leave r1 set high permanently and use c1 .. c9 for control.

huangapple
  • 本文由 发表于 2023年2月7日 02:11:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75365083.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定