Skip to content

05. Embedded Programming

Tasks
  • Group assignment:

    • Demonstrate and compare the toolchains and development workflows for available embedded architectures
    • Document your work to the group work page and reflect on your individual page what you learned
  • Individual assignments:

    • Browse through the data sheet for a microcontroller
    • Write and test a program for an embedded system using a microcontroller to interact (with input &/or output devices) & communicate (with wired or wireless connections)
  • Extra credit:

    • Assemble the system
    • Try different languages &/or development environments

Outline

LED = A/Positive/bent leg/red C/Negative/straight/black

Class

Arduino -C : To compile micro Python : To interperate

Arduino

Install

  1. Download Arduino IDE
  2. File - Preferences

    to install boards add URLS from guide on individual lines

Download 3. Board manager - Install esp 32 s3 4. Compile sketch

Structure

    Void Setup (){
      //code here runs once
    }

    Void loop (){
      //notes for humans
      tone (pin, frequency, milliseconds);
      delay (time); // Wait time for next instruction
    }

Examples

Wokwi ESP32(-S3) Simulator Wokwi

Display changing message on screen

Variable pin response

Application

SOS Beeps

3 long beeps . 3 short beeps . 3 long beeps Will repeat on loop until other instructions are given/power is stopped

SOS Flashes

Adding an LED that flashes the morse code for SOS

Key Terms

PWM
Pulse Width Modulation - digital / analogue signalling in cycles
PCB
Printed Circuet Board
ICs
Integrated Circuet (Processor)
Firmware
Built in to program the hardware
Compile
Transfer instructions into assembly language
Toolchain
What runs to put code on controller

Notes

Page 62 11/02/2026 Wednesday Lectures Embedded programming

PWM - Pulse Width Modulation digital / analog signaling in cycles

  • Modify existing code

• Assembly laungage - pios/old simple • C ‘level’ - efficient mid level • Python - more energy, more instructions Thorny

• Arduino for implimenting processes • Xiao easier implimenting board • Wokai - processor Simulator

Rasberry Pi. Data sheet Tool chain installed & loading code Programming microcontroller

Page 63 - 66 12/02/2026 Thursday Class

A mechanical process that makes analogue movements into digital calculations

PCB - Printed Circuet Board ICs - Integrated Circuet (Processor)

Program ~ CPU ~ Data Firmware - Built in to program the hardware

Arduino -C To compile micro Python - To interperate Compile - transfer instructions into assembly laungage Toolchain- stuff that runs to put code on controller

  1. Download Arduino IDE
  2. File - Preferences to install boards URLS on guide, use individual lines
  3. Board manager - Install esp 32 *if processing timeout to short change arduino-cli.yaml
  4. Compile sketch
Void Setup (){
//code here runs once
}

Void loop (){
//notes for humans
tone (pin, frequency, milliseconds);
delay (time); // Wait time for next instruction
}

Wokwi- ESP32 - S3

Class - uppercase e. g. Serial Function- no cap e. g. delay

Pin = location (ref data sheet for pin number) *add new parts in simulation window Black = Ground (?low) Red = Pin (?high)

Arduino can have built in parts, check reference for inputs assigned to specific pins

Barduino - inputs/outputs Barca modified practice Arduino

  • multiple gnd don’t need defining, all must be grounded individually or as a functional loop

LED = A/Positive/bent leg/red C/Negative/straight/black always on e.g. 3V3,to be variable, assign pin with red, black stays on ground

Voltage: High=Positive Low=Negative ?O=Ground electricity flows high to low

LED on/off Activate Pin:

Void setup
pinMode (pin, OUTPUT);

VoidLoop
digitalWrite(pin, HIGH);
tone...
delay…
Serial.println ("Hey!");
digitalWrite (pin, Low);


Serial.begin  //open communication with computer
Serial = processor e.g.screen

Setup
int isButtonPressed = digitalRead (0);
Serial.println (isButtonPressed);
    //send info back to processor
Loop
Serial.beginl();
pinMode (0, INPUT);