zoukankan      html  css  js  c++  java
  • 用Tinkercad学arduino之 多喇叭发声

    /*
      Multiple tone player
    
      Plays multiple tones on multiple pins in
      sequence
    
      circuit:
      * 3 8-ohm speaker on digital pins 6, 7, and 8
    
      created 8 March 2010  by Tom Igoe  based on a
      snippet from Greg Borenstein
    
      This example code is in the public domain.
      http://www.arduino.cc/en/Tutorial/Tone4
    */
    
    int pos = 0;
    
    void setup()
    {
      pinMode(8, OUTPUT);
      pinMode(6, OUTPUT);
      pinMode(7, OUTPUT);
    }
    
    void loop()
    {
      // turn off tone function for pin 8:
      noTone(8);
      // play a note on pin 6 for 200 ms:
      tone(6, 880, 200); // play tone 69 (A5 = 880 Hz)
      delay(200); // Wait for 200 millisecond(s)
      // turn off tone function for pin 6:
      noTone(6);
      // play a note on pin 7 for 500 ms:
      tone(7, 988, 500); // play tone 71 (B5 = 988 Hz)
      delay(500); // Wait for 500 millisecond(s)
      // turn off tone function for pin 7:
      noTone(7);
      // play a note on pin 8 for 300 ms:
      tone(8, 1047, 300); // play tone 72 (C6 = 1047 Hz)
      delay(300); // Wait for 300 millisecond(s)
    }
  • 相关阅读:
    transition的属性变化
    transition过渡动画
    增删改查的45道题
    4月18 数据库的CRUD操作
    php 中输入输出提交
    4月12 php练习
    3月29 表单以及正则表达式
    3月27 隐藏导航
    3月26 document的练习
    3月25 JavaScript 练习题
  • 原文地址:https://www.cnblogs.com/meetrice/p/14077969.html
Copyright © 2011-2022 走看看