/*
robotronix.co.il
play tone with a loop
*/
const int speaker1 = 9;
const int Led1 = 9;
void setup() {
pinMode(speaker1, OUTPUT);
tone(speaker1, 1200); // Send 1200KHz sound signal, which is a G tone
delay(50);
noTone(speaker1); // Stop sound
delay(300);
tone(speaker1, 1200); // Send 1200KHz sound signal, which is a G tone
delay(50);
noTone(speaker1); // Stop sound
delay(300);
tone(speaker1, 1200); // Send 1200KHz sound signal, which is a G tone
delay(250);
noTone(speaker1); // Stop sound
delay(2000);
//use for loop
for(int i=0;i<3;i=i+1) // I=I+1 --> I++
{
tone(speaker1, 1200); // Send 1200KHz sound signal, which is a G tone
delay(300);
tone(speaker1, 1400); // Send 1400KHz sound signal, which is a G tone
delay(300);
noTone(speaker1); // Stop sound
delay(200);
}
}
void loop() {}