For the homework, I had to use something I didn’t get to try previously so I chose the Servo Motor. Setting it up was pretty easy following this tutorial, and the Servo Motor swept back and forth without any trouble.

I added a Potentiometer to control this Servo Motor, and it still works out pretty well. On top of that, I added a LED that is also controlled by the Potentiometer to make it fade. However, I feel that the input of the two components are having a face-to-face and somehow cancel the fade effect…? The Potentiometer still lights up the LED at the end of its turn though.

On another note, this module seems pretty similar that of the Stepper Motor, but it is not as precise — the Stepper Motor is defined by steps and you can choose the angle of each step, while the Servo Motor turns around at once. Hence it seems to have less possibilities, but certainly I wasn’t able to make full use of it.

The exercice was to to do an intervention using what we’ve learned during last week’s class, aka the use of the push button and the potentiometer with LEDs.

I got in my possession a RGB LED that I’ve really wanted to try out. Basically, I wanted the push button to light on / off the LED, and the potentiometer to change the RGB value of the LED.

The RGB LED got 4 legs, the 2nd leg which is the longest one is (-) while the others legs are (+). I connected the three (+) legs into the digital input, and the (-) into the ground. For each (+) leg, I used a 330Ω resistor.

Then, I connected the push button and the potentiometer, following what I’ve been taught previously. I used a 10KΩ resistor for the push button.

I’ve followed last week’s code to write this new one, and I researched tutorials (notably on Adafruit) to implement the RGB LED’s part.

However, it didn’t work out exactly the way I wanted since I can’t seem to work out the part where the switch stays on / off until its next state’s change. I can’t figure it out for now but it still works for the most part. Hopefully, as I get more comfortable with Arduino, I’ll get back to it later and solve it.