Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define pinBuzzer 8
- int freqMax = 0;
- void setup () {
- Serial.begin(9600);
- pinMode(pinBuzzer, OUTPUT);
- }
- void loop () {
- /*for (int freq = 0; freq < 20000; freq+=50) {
- //tone(pinBuzz, freq);
- noTone(pinBuzz);
- }*/
- freqMax = random(0, 4000);
- Serial.print("A frequencia maxima: ");
- Serial.println(freqMax);
- short freqDiv = freqMax/4;
- Serial.print("A frequencia divida por 4: ");
- Serial.println(freqDiv);
- for (int freqInicial = 0; freqInicial < freqMax; freqInicial+=(freqMax/4)) {
- //tone(pinBuzzer, freqInicial);
- }
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment