pcDuino: miniPC Arduino 觸摸傳感器模塊的鏈接器套件 例程

 

Touch Sensor Module of Linker Kit on pcDuino

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

Protoshield

 

DSCF1386

 Now we can add Arduino shield. git

We use Linker kit in this tutorial: ubuntu

 5

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); }

相關文章
相關標籤/搜索