PComp no, go back to the computer science stuff!
Videos and Notes
So analog output is used for variable voltage (LED dimming, DC motors). This is done in Arduino using analogWrite(). What this does is basically turn the set pin on high and low (on and off) at a variable fast rate since digital output pins cannot actually vary but are a binary value. To create different variable voltages, we alter the duty cycle - the ratio of the time pin is on high to the time it takes for the pin to go off-on-off (the period). The width is the time that the pin is set to high. As the duty cycle decreases (either the width is shrinking or the time the pin is off increases), the effective voltage decreases; the idea is the same for increasing the effective voltage. To do so, we can alter the width using a pulse width modulator (PWM).
Altering the width can change the intensity (volume?) of a tone but changing the frequency alters the pitch of the tone.
- In the diagram drawn of Pulse Width Modulation, is the effective voltage the same as pseudo-analog voltage? If not, what's the difference?
- The circuit diagram for the motor doesn't quite make sense - if the transistor is connected to the output the why is voltage shown as going directly into the motor?
- In the Analog Output video, what is the output from A0 connected to again? I think it's connected to the control wire of the potentiometer but I can't quite tell.
- The Scope video totally eluded me. I get why you would use an oscilloscope, but how to use it... not so much
- ^^also applies to the oscilloscope usage in the Servo video
Working from home, let's see how this goes
I have all my stuff - for the variable resistance I used my potentiometer since I don't have a flex resistor. The picture in the lab materials portion is misleading - the triple red band resistor isn't the 10k resistor. Hooray for visual resistor calculators on the Internet. I did have one though so that worked out
I wired up my Servo but had to do some Googling as to how to assemble it since the rotors were not attached (apparently you can just push them on and pop them off, who knew? That would have been helpful to know).
CODE! Since I'm using a potentiometer I can access the full range of possible values from 0 to 1023. Question - why is the range only to 180 again? I'm guessing it'd cause an out of bounds error, but why?
The motor kept moving even after I stopped moving the potentiometer, is this where I'd need the capacitor to stop the excess voltage from going through?
I'm told that we do have a speaker component in our kits (WHOOPS) so I will be able to do the lab (sorry this is so late!!)
I don't know what happened to my light resistor, I thought I had one but apparently I don't so I used the pressure sensor and was able to get it to work