Intro to

Electronics & Microcontrollers

for LED Lighting

Session 1

What is Computation?

“Any type of calculation that includes both arithmetical and non-arithmetical steps and which follows a well-defined model (e.g. an algorithm).”

Wikipedia

What is an Algorithm?

An algorithm is a plan of things to do that will achieve a specified goal.

Then What is a Program?

program is a translation of an algorithm into a set of instructions that follow all the rules of a given programming language (and can be executed by a computer.)

Practice!

  • outside activity
  • game time!

What is a Computer?

Something that can execute an algorithm (implemented as a program) to compute an answer. It needs to be able to take inputs, provide outputs, and remember things about where it is in the algorithm (it’s state.)

First Useful Computers

Teams of women who calculated trajectory tables, and solved other mathematical problems.

Related- watch

Hidden Figures

1880: Harvard Computers

Electronic Machines

  • Central Processing Unit (CPU)
    • Microprocessor
  • Memory
  • Input/Output (I/O)
Image: Noun Project

Microcontrollers

CPU + Memory + I/O 

All in one chip!

Image: Noun Project

Microcontrollers typically have two types of memory:

  • Flash: retains it’s content when there’s no power. It’s usually where your program is stored. 
  • RAM: much faster, where running state (eg variables) are kept, requires power to remember.

SOCs

Extreme microcontroller: SOC (system on a chip)- e.g. Raspberry Pi, your phone…

Giants

Ada Lovelace

First Programmer

Alan Turing

Deep theory & real machines.

Turing Machine

A very important, and amazingly simple, model that:

  • showed a simple machine can compute non-trivial problems
  • has far reaching implications in math as to what can (and can’t!) be computed
Image: Noun Project

Discover More

Aside: Some Interesting Characters

Grace Hopper

Made the term “bug” (in)famous after writing

“first actual case of bug being found” 

in her log after her team discovered that a moth was the reason for the Cambridge Mark II computer not working. 

(ref)

Margaret Hamilton

Led NASA’s software team that wrote the landing control software that landed astronauts on the moon. Pioneered the idea of fault tolerant software that can prioritize what to work on given tight constraints. (ref). 

Also see: TedEd VideoGreat talk about Apollo Control Software

Break Time!

Program Structure

Initialization

Image: Noun Project

Toaster or Car?

  • Set up Hardware
  • Set up Variables

But What are Variables?

Think of them as boxes, each with a piece of paper on which a reminder is written.

There can be many boxes…. so each one needs to be labelled with a name.

Image: Noun Project

color = "red"
inventory = 25

...

print(f"We have {inventory} items of color {color}")

Main Loop

Image: Noun Project

Check for Inputs

Image: Noun Project

Update State

Update content of variables.

Image: Noun Project

Outputs

Image: Noun Project

Exit

Image: Noun Project

Practice

Image: Noun Project

<other set of slides>

Break

Wokwi

Scroll to Top