Book Image

Arduino Electronics Blueprints

Book Image

Arduino Electronics Blueprints

Overview of this book

Table of Contents (17 chapters)
Arduino Electronics Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

A Do It Yourself Design Challenge!


Industrial control panels usually have indicators to provide visual feedback on key electromechanics and circuits of a robotic system. An LED can be added to the Capacitor Touch controller to provide hand detection plate visual feedback. The LED turns on when a hand touches the sensor and turns off when it is removed. You can use the onboard LED wired to pin D13 of the Arduino or add an external component. Here are the lines of code to accomplish the task:

int sensorStatus = 0;    // variable to store the servo position
int ledPin = 13; // the number of the LED pin (add this line of code)
void setup() { 
  // initialize the sensor pin as an input:
  pinMode(sensorPin, INPUT); 
  pinMode (ledPin, OUTPUT); (add this line of code)

if (sensorStatus == HIGH) {
  // turn ON LED
  digitalWrite (ledPin, HIGH); (add this line of code)

}

The modified Arduino code for the LED indicator function is shown later. Save the code changes with a different name to reflect...