When I started looking at how I would introduce the potentiometer I ended up doing a lot of reading. The Sparkfun tutorials were great. I decided to look at this first using the analog pins A0-A5 then after seeing this video and doing more research then using the pwm function with digital pins 3,5,6,9,10 and 11.
With the potentiometer I will reteach what we did in grade 7. I am using a Hummingbird kit potentiometer connected to analog pin 0.
The student:
- will be able to obtain analog values
- use logical operators to initiate an action
- use an if else ladder
Using the say command and reading the values of an analog pin I can have the students look at the values generated by the potentiometer. The next step is to work together to create an if else ladder that turns lights on and off in sequential order based on the potentiometer values.
Together we will create one block of the if else ladder that looks at potentiometer values between 0 and 171 then students will finish the code for the rest of the LED’s.
Their code should look something like this. The variable potValue reads the potentiometer value on Analog pin 0. Then pins are set on and off depending on the range of values.