Go Down

Topic: Sounds played through the ultrasonic sensors instead the buzzer (Read 84 times) previous topic - next topic

Zomelock

So something weird happens. Whenever I want to play a sound on my buzzer it plays through my ultrasonic sensors and it doesn't matter if I change the port on the Arduino, it keeps routing it through my ultrasonic sensors. In my code the ultrasonic sensors pins are not even declared just the buzzer's ones.

Code ex :

Code: [Select]

int i=0;
void setup() {
  pinMode(11, OUTPUT);
}

void loop() {
  for(i=700;i<800;i++){
  tone(9,i);
  delay(15);
  }
  for(i=800;i>700;i--){
  tone(9,i);
  delay(15);
  }
  }



I have another code which includes ultrasonic sensors and the other stuff but this one doesn't. It may be some residue from the last uploadings ?

pert

In my code the ultrasonic sensors pins are not even declared just the buzzer's ones.
Code: [Select]
  pinMode(11, OUTPUT);
Code: [Select]

  tone(9,i);

Which pin? 11 or 9?

It may be some residue from the last uploadings ?
No, the previous sketch is erased anytime you upload a new one.

Go Up