PCM Wk 4: Labs

Labs: Analog Output

Motor
Below is a video of my results after following along the “Analog Ouput: Motor Control“. Instead of using the wind motor, I used a motor I already had (unfortunately it doesn’t have any cool tissue or fan on  it so the motion of the result is not too clear). However, I think there is an issue: I don’t think the potentiometer is adjusting anything in my circuit or in the speed of the motor. I think that the motor is running directly from the DC power converter. I’m not sure if that is right. I will work on trying to get the potentiometer connected to the motor in my next step.

 


—-
Servo

I followed along with the “Analog Output: Servo” video and it worked! Below is a video of the result:

 

Code taken from the tutorial video:

“//Analog Output-Servo
//libraries give you increased functionality in your code

#include <Servo.h>

Servo myServo;

void setup() {
// attach servo to pin9
myServo.attach(9);
}

void loop() {
int sensor = analogRead(A0);
int angle = map(sensor, 0, 1023, 0, 180);

if (millis() %20 < 2) {
myServo.write(angle);
}
//delay(20);
}”

—-

Lab 5: Tone Output Using Arduino (WIP, Will be ready soon)

Below is a video that shows the checking of the sensor input range.

 

Play Tones Lab: I followed along with the written lab. Below is a video that shows the different frequencies change based on the analog input (photocell resistors).


Force Sensing Resistor as a Note:

I followed along with the written lab to “make a sketch that plays a note on each sensor when the sensor is above a given threshold.”