Arduino 启动/重置期间触发输出
在启动过程中,打开串行窗口并重置 Arduino 会触发所有输出。我需要防止这种情况发生,我连接了一个非常响亮的喇叭,当我启动机器人时,它真的会吓到观众。
输出可以被阻止或设置为低吗?或者我必须用硬件来做到这一点?
During startup, opening the serial window, and resetting the Arduino triggers all outputs. I need to prevent this, I have a very loud horn connected and it really will scare the audience when I startup the robot.
Can the outputs be blocked or set to low? Or do I have to do this with the hardware?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
复位期间,所有引脚均设置为输入。您应该能够通过添加一个 10k 电阻到地来防止喇叭鸣响。
编辑:
假设您的喇叭连接在输出引脚和接地之间,您也可以将喇叭更改为 VCC 和输出之间。当您进行更改时,您需要更改代码以在想要激活喇叭时清除该位。
During reset all of the pins are set to inputs. You should be able to prevent the horn from sounding by adding a 10k resistor to ground.
Edit:
Assuming your horn is connected between an output pin and ground, you might also be able to change the horn to be between VCC and the output. When you make that change you will need to change the code to clear the bit when you want to activate the horn.