In this tutorial, we are going to use touch sensor module of Linker kit on pcDuino. php
First, we take a protoshield , and female to female jumpers. html
Now we can add Arduino shield. git
We use Linker kit in this tutorial: ubuntu
With the following code, when we touch the touch module, the LED will light up. It will go off when we remove from the touch module. oop
Code: ui
ubuntu@ubuntu :~/arduino/test$ more touch_sen.c this
/*
* Touch Sensor module of Linker Kit for pcDuino
* http://linksprite.com/wiki/index.php5?title=Touch_Sensor_Module
*/
#include <core.h>
int led_pin = 8; //Connect LED module to GPIO 8
int btn_pin = 7; //Connect touch module to GPIO 7 spa
void setup()
{ .net
pinMode(led_pin, OUTPUT);
pinMode(btn_pin, INPUT);
} code
void loop()
{
int value = digitalRead(btn_pin); // get button status
if ( value == HIGH ) // button pressed { digitalWrite(led_pin, HIGH); // turn on LED } else // button released { digitalWrite(led_pin, LOW); // turn off LED } delay(100); }