Create your own code to generate a PWM signal at a configurable frequency. Use a 4-bit input, so the full range should be represented by 0-15. For example, an input of 4 should produce a 25% duty cycle. Write code that uses your PWM to change the brightness of an LED from 0 to full in 4 seconds (so increase 25% each second). Test that code at the following PWM frequencies: 20Hz, 50Hz, 100Hz, 200Hz. Demonstrate this at all four frequencies.
For this deliverable, we want to connect a motor to the Arduino. The previous Elegoo tutorial linked uses an outdated kit to run a motor. Instead, use this link: https://download.elegoo.com/01%20STEM%20Kits/02%20Mega%202560/Complete/ELEGOO%20The%20Most%20Complete%20Starter%20Kit%20for%20MEGA%20V1.0.2023.05.05.zip. Follow Lesson 29 to connect and test your motor.
Once you are done with that, try to control your motor with the PWM code you wrote in Deliverable A. Does it work at any frequency?
When you are done experimenting with your PWM code, use the hardware PWM (analogWrite) to control the motor, increasing speed from 0 to full (255) in 4 seconds. Demonstrate this.
For this deliverable, you will build a “Useless Machine”. For example, see: https://www.youtube.com/watch?v=kproPsch7i0. You are encouraged to be creative when accomplishing this! To receive full credit, you need to:
You are encouraged to use anything in your kit to accomplish this. Be creative with your interpretation of what a “switch” and “actuator” mean. When in doubt, ask the instructor if your solution meets the objective. You do not need to build a rugged, permanent setup for this. You only need to make sure it can survive a demo. Switches and other hardware will be available to borrow.
Demo