Smart RGB LED control using Touch Pad
In this project, I am going to demonstrate you how to control the RGB LED using Touch pad with the help of the idIoTware shield.
Things used in this project
Hardware components
- Arduino UNO x 1
- Idiotware Shield x 1
- USB-A to B Cable x 1
- Generic Jumper (0.1″) x 2
Software apps and online services
- Arduino IDE
Story
RGB LED Control using Touch Pad
In this project, I am going to demonstrate how to control the on board Intelligent RGB LED using Touch pad with the help of the idIoTware shield.
Working
The Touch pad on the idIoTware shield acts as the input, so every time you touch it, the color of the RGB LED will keep changing. You can use it to make a mood lamp that can change its color, and be controlled by using the touch pad.
Configuring idIoTware Shield
Once we upload the code in Arduino, you can change any color of RGB LED on the shield. You can have your own RGB lamp with 16 million colors on the tip of your finger, without hassling a lot with wires and a breadboard.
Wasn’t it amazing?! Now design your own lamp for a final personalized touch. With the idIoTware shield the sky is the limit.
Schematics
Code
/* The IdIoTWare Shield uses Touchpad attached to pin 4. The IdIoTWare Shield uses a addressable RGB LED to display a spectrum of colors. The CGShield library abstracts the details and provides you the following function: color(RED, GREEN, BLUE); // three arguments are the pixel color, expressed as red, // green and blue brightness levels, // where 0 is dimmest (off) and 255 is maximum brightness (0-255). // for example to set RED color, color(255,0,0); In this example, WS2812 Led changes its color as we toch the touchpad. */ // sets up and initialize CGShield #include <Adafruit_NeoPixel.h> #include <idIoTwareShield.h> #include <Wire.h> // Require for I2C communication idIoTwareShield fs; // Instanciate CGShield instance int buzzerPin = A1; const byte touchpadPin= 4; int counter; void setup() { Serial.begin(9600); pinMode(touchpadPin,INPUT); // declare touchpad as input pinMode(buzzerPin,OUTPUT); brightness(150); } void loop() { touchpad(); if(touchpad()) { beep(250); counter++; Serial.println(counter); switch(counter) { case 1: color(127,0,255); break; case 2: color(0,0,255); break; case 3: color(0,255,0); break; case 4: color(255,255,0); break; case 5: color(255,128,0); break; case 6: color(255,0,0); break; case 7: color(255,255,255); break; case 8: color(0,0,0); break; } } if(counter==8) counter = 0; } //function to check input from touchpad int touchpad() { int touched = digitalRead(touchpadPin); if(touched == HIGH) // check if the input is HIGH return true; else return false; } void beep(int delayValue) { digitalWrite(buzzerPin,HIGH); delay(delayValue); digitalWrite(buzzerPin,LOW); }