当前位置: 首页 > news >正文

Arduino示例代码讲解:Project 07 - Keyboard 键盘

Arduino示例代码讲解:Project 07 - Keyboard 键盘

  • Project 07 - Keyboard 键盘
    • 程序功能概述
        • 功能:
        • 硬件要求:
        • 输出:
    • 代码结构
        • 全局变量
        • `setup()` 函数
        • `loop()` 函数
        • 读取电位器值:
        • 打印电位器值:
        • 播放音调:
    • 运行过程
    • 注意事项

Project 07 - Keyboard 键盘

/*Arduino Starter Kit exampleProject 7  - KeyboardThis sketch is written to accompany Project 7 in theArduino Starter KitParts required:two 10 kilohm resistors1 Megohm resistor220 ohm resistor4 pushbuttonspiezoCreated 13 September 2012by Scott Fitzgeraldhttp://arduino.cc/starterKitThis example code is part of the public domain
*/// create an array of notes
// the numbers below correspond to
// the frequencies of middle C, D, E, and F
int notes[] = {262, 294, 330, 349};void setup() {//start serial communicationSerial.begin(9600);
}void loop() {// create a local variable to hold the input on pin A0int keyVal = analogRead(A0);// send the value from A0 to the Serial MonitorSerial.println(keyVal);// play the note corresponding to each value on A0if (keyVal == 1023) {// play the first frequency in the array o

相关文章:

  • FastAPI-MCP
  • C++运算符重载详解
  • Vue3 + TypeScript,使用祖先传后代模式重构父传子模式
  • 【滑动窗口】串联所有单词的⼦串(hard)
  • 多态的主要好处与不足
  • 10.QT-显示类控件|LCD Number|ProgressBar|Calendar Widget(C++)
  • [论文阅读]Making Retrieval-Augmented Language Models Robust to Irrelevant Context
  • 论文阅读:2024 arxiv DeepInception: Hypnotize Large Language Model to Be Jailbreaker
  • Pandas高级功能
  • C++入门篇(下)
  • 【支付】支付宝支付
  • go+mysql+cocos实现游戏搭建
  • centos停服 迁移centos7.3系统到新搭建的openEuler
  • HTMLCSS实现网页轮播图
  • max31865典型电路
  • 经典算法 表达式求值
  • DEA-Net:基于细节增强卷积和内容引导注意力的单图像去雾
  • 基础理论学习参考
  • 在 Debian 10.x 安装和配置 Samba
  • 论文笔记(七十八)Do generative video models understand physical principles?
  • 全球前瞻|中国印尼举行首次“2+2”部长级会议,美乌将签署矿产协议
  • 4月LPR保持不变:1年期3.1%,5年期以上3.6%
  • 从板凳席到指挥台,横扫广东男篮的少帅潘江究竟有何神奇
  • 新消费观察 | 重点深耕,外资科技企业继续看好中国发展
  • 泸州市长余先河已任四川省委统战部常务副部长
  • 加力扩围支持消费品以旧换新,江苏要送出1800万元彩票