Digital I/O avec Arduino

Readings in Physical Computing

  • Ch 6. pgs 87-136 (this week and next week)
  • Ch 7: Serial Communication [137-143; 149-150; 153-161]

Before the lab

You should have already successfully installed the Arduino environment on your laptop, built the LED circuit, and successfully load/run the “blink” program to make the LED blink. Congratulations!

In lab exercise

Objective

In this lab, we explore some of the digital features of the Arduino Board. Specifically, we’ll be looking at:

  1. Pulse Width Modulation (PWM) which “fakes” analog behavior using digital signals
  2. Serial communication with the laptop allowing for greater design flexibility

In exploring these features, we will use Arduino to not just blink a single LED, but to control and fade several LEDs at once.

Activity

Part 1: From blinking to fading

1. Start with the LED circuit you built for the “Blinking LED” Assignment. For that assignment, we used pin 13 to control the LED and make it blink. Ardiuno has several pins marked PWM which support Pulse Width Modulation. The example code uses Pin 9, so simply move the controlling wire from Pin 13 to Pin 9. 2. Load the example code from the Arduino Sketchbook (File‐>Examples‐>Analog‐>Fading). Load this onto the Arduino and watch the LED Fade.

Part 2: Fading 3 LEDs

3. Extend your circuit so that it includes 3 LEDs according to the diagrams below. Notice Pins 9, 10, and 11 are all marked PWM.

4. The following code dims the 3 LEDs according to a pattern. For your convenience, a copy of the code can be downloaded here (DimmingLEDs.txt). Look at the code and make sure you know what each line does.

For more detail: Digital I/O avec Arduino


A Propos De L'Auteur

Ibrar Ayyub

Je suis expérimenté, rédacteur technique, titulaire d'une Maîtrise en informatique de BZU Multan, Pakistan à l'Université. Avec un arrière-plan couvrant diverses industries, notamment en matière de domotique et de l'ingénierie, j'ai perfectionné mes compétences dans la rédaction claire et concise du contenu. Compétent en tirant parti de l'infographie et des diagrammes, je m'efforce de simplifier des concepts complexes pour les lecteurs. Ma force réside dans une recherche approfondie et de présenter l'information de façon structurée et logique format.

Suivez-Nous:
LinkedinTwitter

Laisser un Commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

fr_FRFrench
Faire défiler vers le Haut