Grove - Touch & Relay
Grove - Touch Sensor enables you to replace press with touch. It can detect the change in capacitance when a finger is near by. That means no matter your finger directly touches the pad or just stays close to the pad, Grove - Touch Sensor would outputs HIGH also.
The Grove-Relay module is a digital normally-open switch. Through it, you can control circuit of high voltage with low voltage, say 5V on the controller.
Hardware Required
- Intel® Edison for Arduino
- Grove Base Shield v2
- Grove Touch Sensor
- Grove Relay
Circuit
Schematic
Touch
Relay
Code
This demo is going to show you how to turn on/off an Relay.
const int touchPin = 3; // the button is attached to digital pin 3 const int relayPin = 7; // the relay is attached to digital pin 7 int buttonState = 0; void setup() { Serial.begin(115200); pinMode(relayPin, OUTPUT); pinMode(touchPin, INPUT); } void loop() { // read the state of the button: buttonState = digitalRead(touchPin); if (buttonState == 1) { digitalWrite(relayPin, HIGH); } else { digitalWrite(relayPin, LOW); } delay(10); }
See Also
Reference sites
'IoT > Intel Edison' 카테고리의 다른 글
Intel IoT Analytics 계정 추가 및 Edison 장치 등록하기 (0) | 2015.03.30 |
---|---|
Intel Edison Stop Arduino functionality (0) | 2015.03.23 |
Grove – Servo (0) | 2015.02.14 |
Grove - LCD RGB Backlight (0) | 2015.02.09 |
Grove – Rotary Angle Sensor (0) | 2015.01.24 |