E2 Laboratory 06
Sensors, Actuators and Psychophysics
Download the folder "Feb25" from the course Google drive folder, and unzip it. We will go over the code in that folder in class.
Task 1: Control a servo motor with the arduino
- Go to the arduino reference https://www.arduino.cc/en/Reference/HomePage
- Click on "Libraries"
- Click on "Servo"
- For the examples go to "Knob"
- Adapt the code for use with your board.
- The schematic is here: http://www.swarthmore.edu/NatSci/echeeve1/Class/E02/E2Board.pdf
- The Servo should attach to your board at either JServo3 or JServo2
- There are three wires, red, black and yellow, and there are letters "B R Y" at the top of the board - match the wires with the colors (B=Black, R=Red, Y=Yellow);
- You'll need to attach a power supply to your board to turn the motor - I have the supplies.
Demo for me when you are done.
Task 2: The squealer
Set up the force sensitive resistor (you may have to solder wires on to the terminals to get them to fit in the breadboard) in a "voltage divider" arrangement so you can measuer force. Write a program that sounds a tone of increasing frequency as you squeeze the resistor harder. There should be at least three distinct tones (though you can use more). There should be no tone if you are not squeezing. Make generous use of "Serial.println" to figure out the range of values from your sensor as you squeeze.
- A demo of the servo program (Task 1).
- A demo of you program that squeals as you squeeze i (Task 2)
- Turn in your code (with comments) for the squealing program on the moodle page (Task 2)