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);
  tone(8,freq[i],30);

PROJECT_06_THEREMIN
Video Player is loading.
Current Time 0:00
Duration -:-
Loaded: 0%
Stream Type LIVE
Remaining Time -:-
 
1x
    • Chapters
    • descriptions off, selected
    • captions off, selected

       

       

      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)
       tone(8,notes[1]);
      (keyVal >= 990 && keyVal <=1010) 

      PROJECT_07_PIZEOTONES
      Video Player is loading.
      Current Time 0:00
      Duration -:-
      Loaded: 0%
      Stream Type LIVE
      Remaining Time -:-
       
      1x
        • Chapters
        • descriptions off, selected
        • captions off, selected


           

          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)
          prevSwitchState=switchState;

          PROJECT_08_TILTSWITCH
          Video Player is loading.
          Current Time 0:00
          Duration -:-
          Loaded: 0%
          Stream Type LIVE
          Remaining Time -:-
           
          1x
            • Chapters
            • descriptions off, selected
            • captions off, selected

               

               

              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) {

              digitalWrite(motorPin,HIGH);
              } else {

              digitalWrite(motorPin,LOW);
              }

              PROJECT_09_MOTORWITHBUTTON_1
              Video Player is loading.
              Current Time 0:00
              Duration -:-
              Loaded: 0%
              Stream Type LIVE
              Remaining Time -:-
               
              1x
                • Chapters
                • descriptions off, selected
                • captions off, selected