Guide

www.SquishyCircuits.com Page 7
Image created with Fritzing
Code:
//Squishy Sound - Code written by Sam Johnson and Modified by Matthew Schmidtbauer for the Squishy
Circuits Project
//Port Definitions and Variable Declarations:
#define SpeakerOutput 9
int analog = 0; // Common resistor connected to analog pin 0 outside leads to ground and +5V
int raw = 0; // Variable to store the raw input value
int frequency = 0; // Variable to store Frequency
void setup()
{}
void loop()
{
raw = analogRead(analog); // Read Voltage over Dough
frequency = raw*2; // Calculate Frequency
tone(SpeakerOutput,frequency); // Output Frequency to Sounding Device
}