Hi everyone!
I’m extremely new to Arduino, and have a university assignment due very soon. My project is Arduino based, and I’m trying to get a Piezo buzzer to make a sound when a force sensor is pressed. Thanks to some Youtube tutorials I’ve got the wiring down as well as the coding, but the board does nothing once I upload the code. I’ll paste the code here. Any help would be extremely appreciated!!!
int force;
void setup() {
pinMode(15, OUTPUT);
Serial.begin(9600);
}
void loop() {
force = analogRead(A0); //defining force as FSR data
if (force < 100) { //if not pressed and not in front
noTone(15); //dont play music
}
else if ((force > 100)) { //if pressed
tone(15, 261); //call a certain note depending on distance
}
}