Simple force sensor input and buzzer output

The day before I was having problem with Force Sensor input and Buzzer Output. So I tried to it again on a completely separate circuit.

Here’s the codes.

//try buzzer and force sensor
int buzzPin = 5; PWM 5
int forcePin = 5; Analog 5
void setup()
void loop()
int forceVal = analogRead(forcePin);
int thisPitch = map(forceVal, 100, 1000, 500, 600) //freq 500 to 600
thisPitch = constrain(thisPitch,500,600) //safety net
if (forceVal > 100)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: