Commented Video Game Sound Code
unknown
c_cpp
7 months ago
499 B
1
Indexable
Never
int pin=13; //set pin to pin 13 void setup() { pinMode(pin,OUTPUT); //set pin to output Serial.begin(9600); //set rate of communication } void loop() { for(int duration=15;duration>=1;duration=duration-1){ //loop 15 times for(int freq=1700;freq<=2300;freq=freq+20){ //loop of increasing frequency tone(pin,freq,duration); //sets each variable for tone Serial.print(freq); //prints to text Serial.print(" "); Serial.println(duration); } } }
Leave a Comment