Skip to content

Instantly share code, notes, and snippets.

@heylimlim
Created October 8, 2019 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heylimlim/f3e279c5eedb8341fa1dc51e5a3222e1 to your computer and use it in GitHub Desktop.
Save heylimlim/f3e279c5eedb8341fa1dc51e5a3222e1 to your computer and use it in GitHub Desktop.
int speakerPin = 10;
const int fsrPin = A0;
int fsrReading;
void setup(void) {
Serial.begin(9600);
pinMode(speakerPin, OUTPUT);
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.println(fsrReading);
delay(10); if (fsrReading >=834) {
long frequency = 300;
tone(speakerPin, frequency );
//delay(200);
noTone(speakerPin);
//delay(100);
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment