Microcontrollers

And the "Hello World" of Hardware

specifically an Arduino Uno R3

What is a microcontroller?

  • a "dedicated" computer
  • you need another system to "program" them (you don't power them up and start typing)
  • often embedded in a device, sometimes called "embedded controller"
  • low power
  • tend to be small, cheap
  • often are "ruggedized"
  • dedicated input device, sometimes has LCD output

Arduino (UNO R3)

  • board ~$25-30
  • an A-B USB cable for power and data transfer ~$4
  • your trusty laptop with the Arduino IDE
  • breadboard - they are awesome! ~$5
  • m-m breadboard wires - lots for ~$5
  • an LED and "matching" resister - lots for ~$30

All items Available at Adafruit and Sparkfun

A blinky led is the

"Hello World" of Hardware

Hardware setup

  • Pins are helpfully marked on the board!
    • docs - click documentation, go to "Input and Output" for more pin information
    • "Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts."
  • Digital Pin ~3 => resistor => LED => GND

Software Setup

  • Arduino IDE - Integrated Development Environment
    • really just a fancy text editor that "knows" about code, might do some extra stuff
  • Arduino has it's own language - reference
  • We will use the following functions:
    • `setup() {}` and `loop() {}`
    • `pinMode(pin, mode)` - in setup
    • `digitalWrite(pin, value)` - in loop
    • `delay(milliseconds)` - in loop
void setup() {
  // put your setup code here, to run once:
  pinMode(3, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(3, HIGH);
  delay(500);
  digitalWrite(3, LOW);
  delay(500);
}

Demo

Emily Platzer

Microcontrollers

By Emily Platzer

Microcontrollers

A talk given at the first meeting of Resistor Alliance on July 13, 2017, and on July 27, 2017

  • 342