Skip to content

4. Embedded programming

Task

1- Read the datasheet for the microcontroller board you are programming.

2- Program the board you have made to do something, with as many different programming.

3- languages and programming environments as possible. (two at least).

Blink 1 sec on 1 sec off

Blink 2 sec on 1 sec off

Blink multiple commands

Morse code on Arduino IDE

// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); }

// the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(500); // wait for a second

digitalWrite(LED_BUILTIN, HIGH); // turn the LED off by making the voltage LOW delay(2000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(3000);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(500);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(3000);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(500);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(500);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(500);

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000);

digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level) delay(3000);

}

Morse code on MU editor

”“”CircuitPython Blink Example - the CircuitPython ‘Hello, World!’“”” import time import board import digitalio

led = digitalio.DigitalInOut(board.LED) led.direction = digitalio.Direction.OUTPUT

while True:

led.value = True

time.sleep(1)

led.value = False

time.sleep(0.5)

led.value = True

time.sleep(2)

led.value = False

time.sleep(3)

led.value = True

time.sleep(1)

led.value = False

time.sleep(0.5)

led.value = True

time.sleep(2)

led.value = False

time.sleep(3)

led.value = True

time.sleep(2)

led.value = False

time.sleep(0.5)

led.value = True

time.sleep(1)

led.value = False

time.sleep(0.5)

led.value = True

time.sleep(2)

led.value = False

time.sleep(0.5)

led.value = True

time.sleep(2)

led.value = False

time.sleep(3)

Last update: July 14, 2024