Touch

The Touch Sensor is sensitive to skin contact.

Input: This module normally outputs 0v, but when touched, sends 5v. When connected to an input on the Arduino using the TinkerKit Shield, you will see 0 when there is no touch, and 1023 when touched.

Module Description: on the back of the module you can find a signal amplifier, a capacitor, a QT 100A single touch controller, a green LED that signals that the module is correctly powered and a yellow LED whose brightness depends on the values output by the module.

Please note this device performs an auto calibration when it is turned on, so if someone is touching the switch surface when it’s turning on, it won’t work. To reset it, cycle power and make sure no one is touching it as you restart.

This module is a SENSOR. The connector is an OUTPUT which must be connected to one of the INPUT connectors on the TinkerKit Shield.

/*
 Touch Sensor
 
 Turns on and off a T010111 LED Module connected to O0,
 when pressing a T000220 Touch Sensor attached to I0.
 
 created in Dec 2011
 by Federico Vanzati
 
 This example code is in the public domain.
 */

// include the TinkerKit library
#include <TinkerKit.h>

// creating the object ‘touch’ that belongs to the ‘TKTouchSensor’ class 
// and giving the value to the desired input pin
TKTouchSensor touch(I0); 

// creating the object ‘led’ that belongs to the ‘TKLed’ class 
// and giving the value to the desired output pin
TKLed led(O0);         

void setup() {
  // TinkerKit ‘object’ eliminate the need for pin declaration with pinMode()
}

void loop()
{
  // check if the touch sensor is pressed.
  // if it is, the touch.state() is HIGH:
  if (touch.get() == HIGH) {
    led.on();     // turn LED on 
  } 
  else {
    led.off();    // turn LED off
  }
}