List of Listings

Chapter 1. Hello Arduino

Listing 1.1. Code required to make an LED blink

Listing 1.2. The setup function

Listing 1.3. An example loop function that blinks an LED on and off

Listing 1.4. Example header code

Listing 1.5. Example code comments

Chapter 2. Digital input and output

Listing 2.1. Five flashing LEDs, flashing after each other

Listing 2.2. Start-stop display

Listing 2.3. Adding a break

Listing 2.4. Reaction tester

Listing 2.5. Reaction timer

Chapter 3. Simple projects: input and output

Listing 3.1. Reading a potentiometer

Listing 3.2. Threshold for a piezoelectric transducer

Listing 3.3. Generating a tone in the speaker

Listing 3.4. Pentatonic keyboard sketch

Chapter 4. Extending Arduino

Listing 4.1. Using the SoftwareSerial library with two ports

Chapter 5. Arduino in motion

Listing 5.1. Sketch to turn a small DC motor on or off

Listing 5.2. Using an L293D to control a small DC motor

Listing 5.3. Controlling motor speed with an L293D

Listing 5.4. Sketch to drive a stepper motor

Listing 5.5. Sketch to rotate a servomotor between 0 and 180 degrees

Listing 5.6. Sketch to control a brushless motor in one direction

Listing 5.7. Sketch to use with ESC that can control speed and direction

Listing 5.8. Sketch to control a brushless motor in both forward and reverse

Chapter 6. Object detection

Listing 6.1. Reading ranges with the Parallax Ping

Listing 6.2. Reading distances with the SRF05

Listing 6.3. Creating a theremin with the GP2D12

Listing 6.4. Detecting motion with the Parallax PIR sensor

Chapter 7. LCD displays

Listing 7.1. Writing text onto your LCD

Listing 7.2. Weather station

Listing 7.3. Drawing to the KS0108 GLCD

Chapter 8. Communications

Listing 8.1. Arduino web server

Listing 8.2. Twitter button-press tweeter

Listing 8.3. Arduino accelerometer client

Listing 8.4. Processing sketch to request accelerometer data from Arduino server

Listing 8.5. Bluetooth test sketch

Listing 8.6. SPI digital potentiometer LED dimmer

Listing 8.7. SD card data logger

Listing 8.8. Cosm sensor logging code

Chapter 9. Game on

Listing 9.1. Sketch to communicate with Nunchuk using I2C

Listing 9.2. Xboxhidboot.cpp

Listing 9.3. Xboxhid.ino complete listing

Chapter 10. Integrating the Arduino with iOS

Listing 10.1. ViewController.h

Listing 10.2. ViewController.m

Listing 10.3. Switching LED from iOS device

Listing 10.4. ViewController.h

Listing 10.5. ViewController.m

Listing 10.6. Sketch for iOS Slider control

Listing 10.7. ViewController.h

Listing 10.8. ViewController.m

Listing 10.9. Sketch to read distance from GP2D12 sensor

Chapter 11. Making wearables

Listing 11.1. TurnSignals.ino

Listing 11.2. WearablePiano.ino

Listing 11.3. headphones.ino

Listing 11.4. win.py

Listing 11.5. osx.py

Listing 11.6. compass.ino

Chapter 12. Adding shields

Listing 12.1. MotorDriving.pde

Listing 12.2. PotToMotors.pde

Listing 12.3. SDShieldWriter.pde

Chapter 13. Software integration

Listing 13.1. Face tracking using OpenCV in Arduino

Listing 13.2. Face tracking in Processing

Listing 13.3. Using Firmata in Processing

Listing 13.4. Pd application as text (AIA13_4.pd)

Listing 13.5. Application to communicate with Pd

Listing 13.6. Arduino application to send temperature data to Python

Listing 13.7. Python application to receive temperature data

Appendix B. Coding primer

Listing B.1. Value of the variable pinLED

Listing B.2. Global and local variables within a sketch

Listing B.3. The switch-case statement

Listing B.4. A for loop printing the value of i, from 0 to 99

Listing B.5. A while loop that prints out the value of i from 0 to 99

Appendix C. Libraries

Listing C.1. Sabre.h

Listing C.2. Sabre.cpp

Listing C.3. Sabre.ino

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset