Now it is time to program your Arduino in Assembly! Follow these steps to get started:
#include <avr/io.h> .global main main:
The following deliverables should be completed entirely in assembly.
The datasheet for the ATMega2560 used in the Arduino Mega is here: https://www.microchip.com/en-us/product/atmega2560. If you have another version, you will need to make sure you find the correct datasheet.
The ATMega2560 to Arduino Mega pinout is here: https://docs.arduino.cc/retired/hacking/hardware/PinMapping2560/ Again, if you have something besides an Arduino Mega, you will need to find the appropriate pinout.
And the AVR assembly instruction manual is here: https://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf
Write assembly code to turn an LED on when a button is pressed and off when the button is not pressed. You do NOT need to use interrupts for this deliverable unless you want to.
Connect a potentiometer to an Analog pin on the Arduino. Write code that uses the potentiometer input to the Arduino to control the LED’s brightness from 0% to 100%. Note: this most be done in software, you cannot connect the LED directly to the potentiometer. It is acceptable is the LED dims but does not turn off at the lowest setting.
If you complete both deliverables, you only need to demonstrate B.
A zip file with all code. This could be one sketch for each deliverable. (30 points)
5 points – Assembly code builds for Arduino
5 points – LED output
5 points – Any input (button or potentiometer)
5 points – Potentiometer input
5 points – LED brightness dependent on potentiometer
5 points – LED brightness smoothly transitions from dim to bright