Input Devices
Output Devices
In the week, the assignment was to add an output device on the microcontroller and I have to program it to do something! I thought it would be a good idea to use the input devices I used earlier.
Output Implementation
For this assignment, I integrated an LED and an OLED Display as output devices. I consulted the ATtiny412 datasheet to identify the appropriate pins:
- Digital Output: Used a 220Ω resistor in series with the LED to limit current. The LED consumes approximately 20mA at 3.3V.
- I2C Communication: Connected the OLED display using the SDA (PA1) and SCL (PA2) pins. I used the Adafruit_SSD1306 library to interface with the display.
I used PWM (Pulse Width Modulation) on pin PA3 to control the brightness of the LED, implementing a "breathing" effect by varying the duty cycle from 0 to 255 in my code.