Workshop 3 Resources
We talked about PWM in the previous workshop which we used to fake analog fading of an LED. This time we will use it to control a servo motor. We will have a look at another built in example, again have a look at the 'File>Examples' menu in the Arduino environment, this time choosing the 'Servo>Knob' sketch.
You will again see a link to a tutorial on the Arduino website with a picture of a circuit similar to the following:
Read the tutorial and build the circuit, you may even need to look up your particular model of servo to find out which wire colours correspond to the ones in the image, they are not all the same. Just google the motor model number if it is not clear.
Have a look at the code and you will see the same remapping of the knob input value to something that the servo motor likes, in this case 0 - 180. The 'myservo.write' function is a special function of the servo library (an add on of some pre written code essentially) that we included in our sketch with the '#include <Servo.h>' at the top. There are many pre-existing libraries with specialist functions that can make our lives much easier.
Upload the code and turn the knob to turn the servo motor.
Workshop 1- Hello World!
Simple use of a button (a digital input) to turn an LED on
Workshop 2 - Analog inputs/outputs
Reading a fader/knob/sensor (analog input) to fade an LED
Workshop 3 - PWM and servo motors
Control a servo motor using Pulse Width Modulation
Workshop 4 - Fritzing!
Having a look at circuit design using Fritzing
Workshop 5 - Soldering
Some tips on soldering
Workshop 6 - Serial Communication
Exploring how to communicate with the computer via serial
Workshop 7 - Controlling Max MSP
A look at Max MSP and how we can speak to it from Arduino
Workshop 8 - Making a video system
A look at some of the built in video modules of Max and using Arduino to control them
Workshop 9 - Max to Arduino
Going the other way and using a Max user interface to control Arduino hardware