Tutorial Digital IO

From Sketching with Hardware at LMU Wiki
Revision as of 23:25, 12 August 2020 by Skwhadmin (talk | contribs) (Created page with "= Digital Input and Output with MicroPyton and ESP32/ESP8266 = In this part of the tutorial, we explain how to control digital outputs and how to read digital inputs using Mic...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Digital Input and Output with MicroPyton and ESP32/ESP8266

In this part of the tutorial, we explain how to control digital outputs and how to read digital inputs using MicroPyton on ESP32/ESP8266. This includes switching the state of the GPIOs (general purpose input output) and also how to create a pulse width modulation output for changing the brightness of an LED or for controlling a servo.

Success criteria

  • you can set a GPIO pin to on or off from the python prompt
  • you can write a loop to blink an external LED
  • you can use pulse width modulation to control the intensity of an LED
  • you can use pulse width modulation to control a servo that can be directly driven from the ESP Module
  • you can read in the status of a GPIO
  • you can connect a switch or a push-button and read its status into a variable

Instructional Videos

Digital Output: Adding an external LED to the controller

In this video on youtube (30:30) we show how to connect an LED and how to control it from MicroPython: https://youtu.be/0KGgYsEZcZM


Digital Output: Connectin an external LED (old version using WebREPL **)

In this video on youtube (16:54) we show how to connect an LED and how to control it from MicroPython: https://youtu.be/G6HZ1etMRbM


PWM Output: connecting a servo (old version using WebREPL **)

In this video on youtube (14:40) we explain the concept of pulse width modulation (PWM) and how to program it in MicrpPython. We show how to use PWM to controll a servo: https://youtu.be/_4bXk8JjQSk


Digital Input - connecting a switch and a push-button **

In this video on youtube (30:31) we explain how to read in digital inputs in MicrpPython. We show how to connect a switch and a push-button and also explain the basic concept of a pull-up resistor: https://youtu.be/va1beT6sxLs