Embeded programming

You can see the PDF Datasheet  

here

6.1 Compare de performance and development workflows for other architectures.

For this assignment we compare 3 different controllers: the RP2040, the ATMEGA320 and the SAM D11C.

Click here to see the RP2040 charactericstics documented by Israel Santacruz, and here to see the charactericstics of the ATMEGA320 documented by Rogelio Córdoba.


Below I show the characteristics of the SAM D11C. A personal note: this microcontroller was the one I worked on last assignment in case the Quentorres components did not arrive, but finally worked with the Queen torres, but I hope one day, when I don't stay up late trying to document an assignment 🫠 1 will finish the SAM D11C.

6.2 Personal conclusions.

It is important to consider from the beginning the tasks that are going to be executed,  this way we can choose the most appropriate microprocessor, thus we can avoid errors or have limitations in their development. Also consider the components required, the majority are easy to obtain but some require more time and more elements to execute certain tasks, finally design and planning is important.

For example, when i was searching on the datasheet, some characteristics were not so easy to find since they were not expressed in tables or in specific quantities, we had to dig deeper into text descriptions, and other schematic files such as the one added for the Queentorres. Just like that and with help from my instructor Iván León it was possible to complete it.

6.3 Write a program for a microcontroller development board.

This was deffinetely de the funny part for the assignment. When I heard Neil explaining the task , I had the crazy idea of ​​turning on the light leds to the rhythm of a sound and although many funny Mexican songs came to mind, I decided for a little piece of a more universal one, the Christmas, Sweet Christmas song (that's what it's called in Spanish) And this was the result:

6.4 Programming process description

Variables

I used Arduino no run the program, first I determinate all the variables: the 3 leds and in addition to the last assignment i also add a led brightness level.

Loop

Then the loop, while I was writing it, I was literally singing the song in silence, I had to adjust the time of the leds about 20 times (or more) until "I got the timing", then unfortunately for me I couldn't find the version of the song that I had already heard on Spotify (I guess because Copyright). This didn't take me that long. 

Led Brightness

Then, I wrote the instruction to regulate the intensity of the light: digitalWrite (Led1, Led1_brightness = 20), and absolutely nothing happened, and there I was moving the value a billion times, and nothing happened. Finally I asked ChatGpt what was wrong in my code and it told me that for this particular case I should change the "digitalwrite" to "analogwrite" and he also explained that this code is used when we want to light an LED with variable intensity.

CRHISTMAS IN MARCH!

6.5 Arduino Code

Below I share the code, I divided it into 3 for space reasons but above all because that was exactly how I separated it; in 3 parts, once the first one was left, I continued with the next one and so on. It was worth it? Yeah!

int Led1=0; int Led2=1; int Led3=26;

int Led1_brightness = 10; int Led2_brightness = 80; int Led3_brightness = 80;

void setup() {

pinMode(Led1,OUTPUT);

pinMode(Led2,OUTPUT);

pinMode(Led3,OUTPUT);

} //IYGIYFIYFI

void loop() {

digitalWrite(Led1, HIGH);

delay(300);

digitalWrite(Led1, LOW);

digitalWrite(Led2, HIGH);

delay(300);

digitalWrite(Led2, LOW);

digitalWrite(Led3, HIGH);

delay(400);

digitalWrite(Led3, LOW);

digitalWrite(Led1, HIGH);

delay(300);

digitalWrite(Led1, LOW);

digitalWrite(Led2, HIGH);

delay(300);

digitalWrite(Led2, LOW);

digitalWrite(Led3, HIGH);

delay(400);

digitalWrite(Led3, LOW);



digitalWrite(Led1, HIGH);

delay(250);

digitalWrite(Led1, LOW);

digitalWrite(Led2, HIGH);

delay(250);

digitalWrite(Led2, LOW);

digitalWrite(Led3, HIGH);

delay(250);

digitalWrite(Led3, LOW);

digitalWrite(Led1, HIGH);

delay(200);

digitalWrite(Led1, LOW);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(200);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(100);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(100);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);


digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(100);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(100);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(100);

digitalWrite(Led1, HIGH);

digitalWrite(Led2, HIGH);

digitalWrite(Led3, HIGH);

delay(100);

analogWrite(Led1, Led1_brightness = 15 );

analogWrite(Led2, Led2_brightness = 15 );

analogWrite(Led3, Led3_brightness = 15 );

delay(3500);

digitalWrite(Led1, LOW);

digitalWrite(Led2, LOW);

digitalWrite(Led3, LOW);

delay(3500);

}


6.6 Personal conclusions

What was most difficult for me in this assignment was to interpret the information. It was complicated because it was not explicit, although I assumed that it would not be like that. 

There are many programming things that I am learning that are not so easy for me to deduct. However, I am satisfied with the result. 

The individual took me a lot mental work and time, I recognize was a whim of mine, not something they had asked me for, however now I see it and it makes me smile, I feel proud and I would like to do more but for now it is enough.