Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
naveen manwani
Published © GPL3+

Using Grove Touch Sensor To Control Grove LED

How to connect and use Grove Touch Sensor to control Grove LED socket kit.

BeginnerProtip30 minutes2,846
Using Grove Touch Sensor To Control Grove LED

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1
Seeed Studio grove starter kit for arduino/genuino 101
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

connection pin of LED socket kit on Base Shield

it will show the connection of led socket kit on pin D7 over Grove Base Shield

connection of Grove_Touch Sensor on Grove Base Shield

connecting Grove Grove_Touch Sensor on pin D3 over Grove Base Shield
which is mounted on Arduino/Genuino 101

complete connection setup

Working setup

Code

To control Grove_LED socket kit through Grove_TouchSensor

C/C++
// this demo will show you how to use Grove - touch sensor to control a LED
// when the touch sensor was  touched, the led will on 
// otherwise led off
// Grove - Touch sensor connect to D3
// Grove - LED connect to D7

const int pinTouch = 3;                        // pin of button define here
const int pinLed    = 7;                        // pin of led define here

void setup()
{
    pinMode(pinTouch, INPUT);                  // set button INPUT
    pinMode(pinLed, OUTPUT);                    // set led OUTPUT
}

void loop()
{
    if(digitalRead(pinTouch))                     // when button is pressed
    {
        digitalWrite(pinLed, HIGH);             // led on
    }
    else
    {
        digitalWrite(pinLed, LOW);
    }
    
    delay(10);
}

Credits

naveen manwani

naveen manwani

9 projects • 9 followers
Electronics & Communication Engineer,machine learning and deep learning enthusiast |Fast.ai Fellowship,Mentor @ coursera deeplearning.ai

Comments