Instructions

  1. Download the Arduino IDE: https://www.arduino.cc/en/software
  2. Download the Starter Kit PDF from Elegoo’s website: https://www.elegoo.com/blogs/arduino-projects/elegoo-mega-2560-basic-starter-kit-tutorial
    NOTE: if you did NOT purchase the MEGA kit, you may need to use a different version or otherwise change pin numbers
  3. Lessons 0 and 1 are not required, but feel free to review if you wish.
  4. Lesson 2 shows you how to program your Arduino. Follow that lesson and make the onboard LED blink.
  5. Deliverable A: Make the built-in LED blink in a pattern 100ms on, 100ms off, 100ms on, 700ms off. You should see two rapid blinks, then a pause.
  6. Lesson 3 shows you how to connect an external LED from your kit to your Arduino. Follow the lesson.
  7. At the end of the lesson, your LED will be plugged into +5V power and ground. Remove the connection to power and instead connect to one of the digital pins.
    HINT: To future proof a bit, avoid pins labeled RX, TX, SDA, SCL, or other things that look special. These are used for other, more advanced functions
  8. Create a new sketch like your blink sketch from Deliverable A, but change the pin number and blink pattern.
  9. Deliverable B: Use your LED to count from 1 to 5. Write code so that the LED blinks 100ms on, 200ms off for the count that it is on. For example, count 3 would look like on 100ms, off 200ms, on 100ms, off 200ms, on 100ms. Pause 700ms before moving to the next number. Use a for or while loop to control your LEDs, do NOT hardcode 1-5.
  10. Lesson 4 shows you how to control a tricolor LED. Follow that lesson.
  11. Deliverable C: Create a program that smoothly transitions the LED through a color pattern of your choice. At some point, all three colors need to be used. The pattern should be nontrivial (e.g. do more than making one color brighter).
    Challenge: smoothly transition through the whole rainbow

 

Submission instructions: Put all of your code in one zipfile and submit to Blackboard. LABEL your code files/folders by deliverable and homework number (e.g. 5A).

Rubric

Demo:

  • Deliverable A: 10 points
    • 3 points: LED is powered on
    • 3 points: LED blinks in some pattern
    • 4 points: LED blinks in specified pattern
  • Deliverable B: 10 points
    • 3 points: external LED connected and controlled in some way
    • 3 points: LED pattern changes
    • 4 points: LED pattern counts in specified pattern
  • Deliverable C: 10 points
    • 1 point: tricolor LED connected
    • 3 points: red LED is used
    • 3 points: green LED is used
    • 3 points: blue LED is used

Code:

  • Deliverable A:
    • 10 points: relevant code submitted
  • Deliverable B:
    • 5 points: relevant code submitted
    • 5 points: LED counts in loop
  • Deliverable C:
    • 5 points: relevant code submitted
    • 5 points: nontrivial pattern