Appendix: Practical Programming Examples
This appendix provides a list of practical projects drawn from the source context. Each project serves as a real-world application of the programming concepts, I/O functions, and communication protocols covered in this manual, offering a starting point for hands-on experimentation and learning.
- Blinking an LED: Demonstrates the most basic sketch structure, using pinMode() and digitalWrite() in the loop() function to control an output.
- Fading an LED: Illustrates the use of analogWrite() to generate a PWM signal, creating a smooth fading effect.
- Reading Analog Voltage: Shows how to use analogRead() to interpret continuous data from a potentiometer and convert it to a voltage value.
- Controlling a DC Motor: Covers controlling motor speed with analogWrite() and direction using an H-Bridge driver circuit.
- Positioning a Servo Motor: Introduces the Servo library to control the precise angular position of a servo motor shaft.
- Driving a Stepper Motor: Uses the Stepper library for precise, step-based motor control, essential for applications like 3D printers and CNC machines.
- Using the Tone Library: Demonstrates how to generate sound and musical notes of specific frequencies and durations with the tone() function.
- Interfacing with Sensors: Summarizes examples for reading both digital and analog data from a variety of sensors, including Humidity, Temperature, Water, PIR (motion), and Ultrasonic (distance) sensors.
- Implementing Keyboard and Mouse Control: Shows how boards with native USB capabilities, like the Leonardo or Micro, can emulate USB Human Interface Devices (HID) to control a computer.
- Wireless and Network Communication: Provides examples of using RF modules for simple wireless links and the CC3000 Wi-Fi module to connect projects to a network and the internet.