Class 03- Lab assignments 06 07 08 09

Lab assignment 06:   Use a Piezo as a Theremin
Use a photoresistor to calibrate a Piezo that changes the frequency.
The calibration process takes place with while loop (millis() < 5000). The key point in calibration is the high and low points are initially reversed. sensorValue <1023 (LOW)
sensorValue > 0 (HIGH)
Key terms:
while (millis() < 5000) {
sensorValue = analogRead(A0);
// remap sensr 0-1023 to freq 50,4000
int pitch = map (sensorValue,sensorLow,sensorHigh,500,4000);



Lab assignment 07:   Use a Piezo as a Keyboard
Using a resistor ladder. Take reading from 5 resistors in series the voltage drops across each resistor giving a different output. The values are converted to frequencies for the piezo.

Key terms:
int notes[] = {262,294,330,349};
int keyVal = analogRead(A0); (0-1023)
(keyVal >= 990 && keyVal <=1010) 


Lab assignment 08:   Digital Hourglass +tilt switch
Using a millis() function to read the time in milliseconds count the interval time and then set on a LED for that time period. Then use the tilt switch to reset all the LED’s.

Key terms:
unsigned long previousTime = 0;
long interval = 1000;
//read switchpin 8
switchState = digitalRead(switchPin);(either 1 or 0)



Lab assignment 09:  Motor switch using a transistor gate and switch
Press a button to send a signal to arduino that resends a high to the transistor gate. That activates the motor. Use a diode in parallel with the motor to counteract reverse induced voltage.

Key terms:
 pinMode(motorPin, OUTPUT);

switchState = digitalRead(switchPin);

if (switchState == HIGH) {

} else {