Beginner's Guide to Arduino Programming

Sep 5, 2024

Arduino Tutorials - Lecture Notes

Introduction

  • Paul McWhorter from TopTechBoy.com presents improved Arduino tutorials.
  • Previous series was popular but needs updating due to:
    • Changes in hardware (more sensors and components available)
    • Changes in software (new IDE versions)
    • Improved production quality
    • Personal touch: switched from hot coffee to iced coffee during lessons.

Learning Objectives

  • By the end of the session, beginners will have:
    • Written their first four Arduino programs.
    • Completed simple assignments based on what they've learned.

Getting Started with Arduino

Step 1: Order Your Hardware

  • Recommended kit: Super Starter Kit Uno R3 by eLEGO.
    • Cost: $35
    • Includes Arduino and various components for projects.
  • If you already have an Arduino, you can start immediately.

Step 2: Install the Software

  • Visit: Arduino Download Page
  • Download the latest version (example: Arduino 1.8.9).
    • Windows Installer for Windows XP and up.
  • Installation Steps:
    • Click download, agree to terms, and complete the standard installation.

Setting Up Arduino Environment

  • Open the Arduino IDE after installation.
  • Connect the Arduino to your PC via USB; check for recognition sounds.

Writing Your First Program

Bare Minimum Example

  • Navigate in IDE: File > Examples > Basic > Bare Minimum
  • Essential Parts of Arduino Programs:
    1. void setup() - Runs once to initialize settings.
    2. void loop() - Runs continuously.

Initializing Pin 13

  • Use pinMode(13, OUTPUT); in void setup() to set pin 13 as output.

Controlling the LED

  • To turn on the LED (connected to pin 13):
    • Use digitalWrite(13, HIGH); in void loop();
  • To turn off the LED:
    • Use digitalWrite(13, LOW); in void loop();

Blinking the LED

  • To make the LED blink, use delay(1000); (for 1 second on, 1 second off).
    • Example Program:
      void loop() {
          digitalWrite(13, HIGH);
          delay(1000);
          digitalWrite(13, LOW);
          delay(1000);
      }
      

Experimenting with Blink Speed

  • Adjust delay times to explore how fast the LED can blink while remaining visible:
    • Example settings: 500ms on/off for fast blink.

Assignments

  1. Experiment with different blink speeds to see the fastest perceivable blink.
  2. Share results in comments.

Conclusion

  • Paul encourages viewers to engage with the content by:
    • Liking the video
    • Subscribing to the channel
    • Sharing experiences in the comments.