This week we were assigned to use different types of software to program and see how efficient each of the programming languages is. For this week I thought about creating a basic code for my PCB to play a song. To accomplish this task, use my PCB from Week 4
On the group page you will find information to be able to program in C++, PHYTON and Microphiton. There is also information about some microcontrollers that are in stock, you can consult it here
Architecture | AVR (8-bit) | ARM Cortex-M0+ | RISC-V (32-bit) | Xtensa (LX6/LX7) | Tensilica L106 (32-bit) | ARM Cortex-M4F |
---|---|---|---|---|---|---|
Pros | Low power consumption, Simple to program, Good community support | Energy efficient, Wide range of tools, High performance for 32-bit | Open source architecture, Scalable, Flexible | Highly customizable, Good for DSP applications, Integrated Wi-Fi and Bluetooth | Low cost, Integrated Wi-Fi, Good SDK support | High performance, Floating point unit, Energy efficient |
contras | Limited processing power, Fewer advanced peripherals | More complex to program than AVR, Higher cost | Less mature ecosystem, Fewer ready-to-use libraries | Proprietary, Requires licensing for commercial use | Single core, Less powerful than newer ESP32 models | More expensive than simpler cores, Complex for beginners |
Key data types | Description |
---|---|
Integer | for integer values. |
Floating Point | for decimal numbers. |
Character | for single characters. |
Void | absence of data. |
Operator Type | Description |
---|---|
Logical | Used in conditions (&&, ||, !) |
Bitwise | Operates on bits (&, |, ^, ~) |
Shift | Shifts bits left or right (<<, >>) |
Control Flow Type | Description |
---|---|
If, Else, Switch | Decision structures that execute code based on conditions. |
Loops (For, While, Do-While) | Repeat code blocks while certain conditions are met. |
This program uses an ATtiny85 to control an RGB LED, allowing color combinations of red, blue, and green through two buttons. Pins 2, 1, and 0 are connected to each color output of the LED, while the control buttons are on pins 3 and 4.
This program controls an RGB LED through a counter ranging from 0 to 7, adjusted with two buttons. Each counter value lights up the LED with a specific color combination: red, blue, green, pink, yellow, cyan, or white. A 500 ms delay ensures the button presses are registered without unwanted bouncing.
This code alternates the color of a Neopixel LED between red, green, and blue every second, demonstrating single-wire serial color control.
This code controls a strip of 5 Neopixel LEDs connected to pin 0 of the microcontroller. During each loop cycle, the LEDs progressively light up in red, starting from the first LED, with a 500 ms delay between each update.
This lesson has been very helpful in advancing my programming skills. I’ve always thought of programming as the "soul" of a person, yet I’ve come to realize there were still many things I didn’t know, like the pros and cons of different languages and data types. At times, it’s been a bit stressful, especially when trying to upload code to my MCU, as it occasionally doesn’t work as expected.