In this eighth assignment, we are introduced to embedded programming. After reading the Arduino ATmega328P datasheet I understood that it is present on the Arduino UNO board but also on other similar models such as Arduino Funduino UNO. It has 14 digital inputs and outputs, of which 6 can be used as PWM, it also has 6 analog inputs, it runs with a 16 Mhz resonator, it has a USB connection, a jack for external power, an ICSP connector and a reset button.
Arduino pinout diagram.
· Microcontroller: ATmega328
· Operation voltage: 5V
· Input voltage: 7 - 12V
· Input voltage range: 6-20V
· Digital I / O pins: 14 (6 PWM)
· ADC: 6
· Current per I / O pin: 40mA
· Flash memory: 32KB (0.5 KB used in bootloader)
· SRMA: 2KB
· EEPROM: 1KB
· Clock: 16Mhz
· VCC = digital supply voltage.
· GND = ground.
· Port B = 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
· Port C = 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
· PC6/RESET = if the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C.
· Port D = 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).
· AVcc = supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to VCC, even if the ADC is not used.
· AREF = analog reference pin for the A/D Converter.
· ADC7:6 = TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.
Programming a LED with analog/digital write
I started testing to operate the led with a button and a potentiometer that I have in the Keyestudio kit. In the case of the button it is programmed with “digital write” since the information is 0 or 1 (false or true). In the case of the potentiometer, it is programmed with “analog write” since the information comprises a range of values between 0 and 255. I have been looking at the following tutorials to get started:
Testing the Tutorials
LED (Digital Write)
LED + Push Button (Digital Write)
LED + Potentiometer (Analog Write)
LED + Capacitive Sensor (Analog Write)
Here you can find the files: