Skip to content

4. Embedded programming

This week I worked on the microcontroller which is one of the most important part on the electronic devises.

Research

To learn about the microcontroller, we were divide to groups and each group start to research about there microcontroller to learn about it and to get more information about the microcontroller. After collecting all the information about the microcontroller, a person from each group start to explain the collected information and all these information were recorded as it can be seen in the following link.

Individual Assignment

It was important to learn how to program our microcontroller; therefore, the assignment was to turn on the light on the microcontroller. After turning on the light on the microcontroller, we start to learn how to control the timing to let the light blink according to the programmed time as it can be seen in the following code:-

Than, different codes were use to control the lighting time

and this following link present how the microcontroller will work by using the previous code.

To get more familiar with the microcontroller coding, Brilliant-Turing program were used to create more codes as it can be seen in the following photos:-

After getting familiar with controlling the microcontroller, it was recommended to select a word and convert it to Morse code and implement it on the microcontroller light.

The code were made in the beginning on Brilliant-Turing program then the code were taken to be applied on the microcontroller as it can be seen below:-

Morse code:-

The following code present the selected work Morse code:-

// C++ code
//
int counter;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  for (counter = 0; counter < 6; ++counter) {
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(2000); // Wait for 2000 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(1000); // Wait for 1000 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(2000); // Wait for 2000 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(1000); // Wait for 1000 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(500); // Wait for 500 millisecond(s)
    digitalWrite(LED_BUILTIN, HIGH);
    delay(1000); // Wait for 1000 millisecond(s)
    digitalWrite(LED_BUILTIN, LOW);
    delay(4000); // Wait for 4000 millisecond(s)
  }
}

Last update: August 14, 2022