Day 01 Foundations

Day 1

Day 1

~1 hour Intermediate Hands-on Precision AI Academy

Today's Objective

Arduino is the fastest path from idea to blinking LED. Today you'll get the IDE running, understand the sketch structure, and write your first program.

Arduino IDE and Board Setup

Download the Arduino IDE 2 from arduino.cc. Install it. Connect your Arduino Uno or Nano via USB. In Tools → Board, select 'Arduino Uno'. In Tools → Port, select the COM port (Windows) or /dev/cu.usbmodem... (macOS) or /dev/ttyACM0 (Linux). If Linux shows permission errors: sudo usermod -aG dialout $USER then log out and back in.

Sketch Structure

Every Arduino sketch has two functions. setup() runs once at power-on — initialize pins, serial port, and libraries here. loop() runs forever after setup — this is where your main logic lives. There is no main() — the Arduino framework wraps everything. The built-in LED is on pin 13 (constant LED_BUILTIN). pinMode(pin, OUTPUT) configures a pin. digitalWrite(pin, HIGH) sets it to 5V.

Serial Monitor for Debugging

Serial.begin(9600) in setup() opens a UART connection at 9600 baud. Serial.println(value) sends a line. Open the Serial Monitor (Ctrl+Shift+M) — it shows live output from the Arduino. This is your primary debugging tool. Use Serial.print() without newline for inline values, Serial.println() to add a newline.

cpp.txt
CPP
// Arduino Blink with Serial feedback
// Upload to Arduino Uno/Nano via Arduino IDE

const int LED_PIN = LED_BUILTIN; // Pin 13
const int BLINK_INTERVAL = 500;  // milliseconds

void setup() {
  Serial.begin(9600);
  pinMode(LED_PIN, OUTPUT);
  Serial.println("Arduino started. Blinking LED...");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  Serial.println("LED ON");
  delay(BLINK_INTERVAL);

  digitalWrite(LED_PIN, LOW);
  Serial.println("LED OFF");
  delay(BLINK_INTERVAL);
}

// ── Non-blocking blink (better practice) ────────────
// Use millis() instead of delay() so other code can run
unsigned long lastToggle = 0;
bool ledState = false;

void loop_nonblocking() {
  unsigned long now = millis();
  if (now - lastToggle >= BLINK_INTERVAL) {
    lastToggle = now;
    ledState = !ledState;
    digitalWrite(LED_PIN, ledState ? HIGH : LOW);
    Serial.print("LED: ");
    Serial.println(ledState ? "ON" : "OFF");
  }
  // Other code here runs every iteration without blocking
}
Never use delay() in real projects — it blocks everything. Use millis() to track elapsed time and take action when enough time has passed. This lets the same loop handle multiple timers simultaneously.
Exercise
Blink Three LEDs at Different Rates
  1. Wire 3 LEDs with 330Ω resistors to pins 9, 10, 11.
  2. Implement non-blocking blink for each LED: 250ms, 500ms, 1000ms intervals using millis().
  3. Add Serial output: print which LED toggled and at what millis() time.
  4. Verify all three blink independently without blocking each other.
  5. Add a 4th state: when all three are ON simultaneously, print 'SYNC' to serial.

Implement a Morse code transmitter. Define a string message (e.g., 'SOS'). Encode dots (250ms on, 250ms off) and dashes (750ms on, 250ms off) with 500ms gap between letters. Use only millis() — no delay(). Print each symbol to Serial as it transmits.

What's Next

The foundations from today carry directly into Day 2. In the next session the focus shifts to Day 2 — building directly on everything covered here.

Supporting Videos & Reading

Go deeper with these external references.

Day 1 Checkpoint

Before moving on, verify you can answer these without looking:

Live Bootcamp

Learn this in person — 2 days, 5 cities

Thu–Fri sessions in Denver, Los Angeles, New York, Chicago, and Dallas. $1,490 per seat. June–October 2026.

Reserve Your Seat →
Continue To Day 2
Day 2