Week 1: Introduction to Arduino & Programming

Welcome to the world of robotics programming!

🎯 Learning Objectives

By the end of this lesson, students will:

  • Understand what programming is and why it's useful for robotics
  • Identify the main components of an Arduino microcontroller
  • Install and navigate the Arduino IDE
  • Understand Arduino program structure and basic syntax

Skills Developed:

  • Problem-solving mindset
  • Basic programming concepts
  • Hardware-software interaction
  • Technical communication

Lesson Content

1 What is Programming? (15 minutes)

Programming is like giving instructions:

  • Everyday example: Following a recipe to bake cookies
  • Programming: Writing step-by-step instructions for a computer
  • Robotics: Telling a robot how to move, sense, and respond
  • Why it matters: Enables us to create smart, automated systems

Real-World Programming Examples:

🏠 Smart Home: Automatic lights, thermostats

🚗 Cars: Anti-lock brakes, GPS navigation

📱 Phones: Apps, camera features, games

🤖 Robots: Vacuum cleaners, manufacturing arms

🎮 Games: Character movement, scoring systems

🌐 Internet: Websites, social media, search engines

2 Understanding Programming Concepts (20 minutes)

What is a Program?

A program is a set of instructions that tells a computer what to do:

  • Input: Receive information (keyboard, mouse, sensors)
  • Process: Make decisions and calculations
  • Output: Display results or control devices
  • Storage: Remember information for later use

Programming Languages:

🐍 Python: Easy to learn, great for beginners

☕ JavaScript: Powers websites and web apps

📊 C++: Fast and powerful for complex programs

🤖 Arduino C: Controls microcontrollers and robots

🎮 Scratch: Visual programming with blocks

📱 Swift: Creates iPhone and iPad apps

☕ Java: Runs on many different devices

🌐 HTML/CSS: Creates and styles web pages

3 Exploring Online Programming Simulators (25 minutes)

What is a Programming Simulator?

A simulator lets you write and test code without needing physical hardware. Perfect for learning!

  • Code Editor: Where you write your programs
  • Virtual Hardware: Simulated components you can control
  • Real-time Testing: See your code work instantly
  • Safe Learning: No risk of damaging real components

Recommended Online Simulators:

🌟 TinkerCAD Circuits: Free, beginner-friendly Arduino simulator

🚀 Wokwi: Advanced features with real-time simulation

🔧 SimulIDE: Comprehensive electronics simulator

🌐 Browser-based: No software installation needed

📱 Mobile-friendly: Works on tablets and phones

🎯 Perfect for learning: Safe environment to experiment

4 Programming Structure & Hands-On Practice (30 minutes)

Understanding Program Structure:

Most programs follow a similar structure with key components:

  • Initialization: Set up variables and starting conditions
  • Main Logic: The core functionality that repeats or responds to events
  • Functions: Reusable blocks of code that perform specific tasks
  • Comments: Human-readable notes that explain what the code does

Online Arduino Simulators (No Hardware Needed!):

🌟 TinkerCAD Circuits: Free, beginner-friendly

🚀 Wokwi: Advanced features, real-time simulation

🔧 EasyEDA: Professional circuit design

✅ Browser-based: No software installation

✅ Visual components: Drag-and-drop interface

✅ Code testing: See results instantly

$// My First Arduino Program - Hello World
// This program demonstrates basic structure and serial communication

void setup() {
  // This runs once when Arduino starts
  Serial.begin(9600);        // Start serial communication
  Serial.println("Hello, Arduino World!");
  Serial.println("Program started successfully!");
}

void loop() {
  // This runs over and over again
  Serial.print("Program running... Time: ");
  Serial.print(millis() / 1000);  // Show seconds since start
  Serial.println(" seconds");
  delay(2000);               // Wait 2 seconds
}

Code Explanation:

  • // Creates comments (notes for humans, ignored by Arduino)
  • Serial.begin(9600): Starts communication with the computer
  • Serial.println(): Sends messages to the Serial Monitor
  • millis(): Returns milliseconds since the program started
  • delay(2000): Pauses the program for 2000 milliseconds (2 seconds)

5 Hands-On Activity: Arduino Simulator Exploration (20 minutes)

Simulator Setup & Exploration:

Choose an online simulator and try these programming challenges:

🌟 Step 1: Go to TinkerCAD.com and create a free account

🚀 Challenge 1: Create the "Hello World" program

🚀 Challenge 2: Modify the delay time (try 1000, 3000, 500)

🚀 Challenge 3: Add your name to the serial messages

🚀 Challenge 4: Create a countdown timer (10, 9, 8...)

🚀 Challenge 5: Add more comments explaining your code

Bonus Challenges (If Time Permits):

🎆 Advanced 1: Create a simple math calculator in serial

🎆 Advanced 2: Make a program that counts to 100

🎆 Advanced 3: Display the current "uptime" in minutes

🎆 Advanced 4: Create a simple "robot status" reporter

Troubleshooting Tips:

  • Simulator not loading? Try refreshing the browser or switching browsers
  • Code not running? Check for missing semicolons (;) and brackets
  • Serial Monitor blank? Make sure you included Serial.begin(9600) in setup()
  • Need help? Ask a classmate or raise your hand!

📝 Assessment & Homework

📊 Quick Assessment

  • • Successfully upload and run the Hello World program
  • • Explain what setup() and loop() functions do
  • • Identify Arduino IDE interface components
  • • Add meaningful comments to code

🏠 Homework Assignment

  • • Practice: Create 3 different Serial Monitor programs
  • • Research: Find one Arduino project that interests you
  • • Reflection: Write about what programming means to you
  • • Prepare questions about Arduino for next class
← Previous: Course Overview
📝 Take Quiz Next: Week 2 →