1 of 20

Introduction to embedded programming

Using Arduino

2 of 20

Microcontrollers

“A microcontroller is a computer present in a single integrated circuit which is dedicated to perform one task and execute one specific application.

It contains memory, programmable input/output peripherals as well a processor. “ - Source: Wikipedia

3 of 20

What contains microcontrollers?

4 of 20

What contains microcontrollers?

5 of 20

What contains microcontrollers?

6 of 20

What contains microcontrollers?

7 of 20

What contains microcontrollers?

8 of 20

What contains microcontrollers?

9 of 20

What contains microcontrollers?

10 of 20

Arduino

11 of 20

Arduino clones

  • Teensy
  • Gizduino
  • Sparkfun RedBoard
  • Iduino
  • Tinyduino
  • Freeduino
  • Nurduino
  • etc

12 of 20

Other platforms

ESP8266 based chips

  • Integrated WiFi
  • 80MHz or 160MHz
  • 128kB RAM
  • Storage up to 4Mb
  • Many different connections
  • Power efficient
  • Very small
  • Runs on 3.3V

13 of 20

Other platforms

ARM based SOC’s

  • Raspberry PI (ARM Cortex A53 64bit quad-core)
  • Pine64 (ARM Cortex A53 64bit quad-core)
  • Beagle Bone Black (ARM Cortex A8 dual core)
  • etc

Runs Linux and Android

Close to normal PC

14 of 20

Arduino IDE

  • Integrated Development Environment
  • Developed by Arduino
  • Open Source
  • Compatible with many boards
    • Arduino
    • Arduino clones
    • ESP8266 boards
  • Many user and company contributed libraries

15 of 20

Programming

  • Variables
    • Integer
    • Float
    • Character array
    • String
    • Boolean
  • for/while loop
  • if, then, else
  • Arduino specific:
    • setup
    • loop
    • DigitalWrite
    • DigitalRead
    • High/Low

int LED = 2;�void setup() {� pinMode(LED, OUTPUT);�}

void loop() {� digitalWrite(LED, LOW);� delay(1000);� digitalWrite(LED, HIGH);� delay(1000);�}

  • Digital pins: 1/0 = HIGH/LOW = 5V/0V
  • Analog pins
  • VCC: input voltage (+) (3.3V)
  • GND: Ground (-)

16 of 20

https://www.arduino.cc/en/Reference/HomePage

17 of 20

Links

18 of 20

Let’s build!

Blink the LED in a regular interval

Use

  • digitalWrite
  • delay
  • pinMode

19 of 20

Components

  • Microcontroller: NodeMCU
  • LED
  • 220 Ohm Resistor
  • Breadboard
  • Some breadboard wires
  • Computer with usb port, arduino 1.8.3 and esp8266 board add-ons

20 of 20

Let’s build!

Add a button to the previous example. Make sure the LED switches on when you press the button.

Use:

  • digitalRead
  • pinMode
  • delay
  • digitalWrite