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.

First, we take a protoshield , and female to female jumpers.

pcDuino: miniPC Arduino 触摸传感器模块的连接器套件 例程_第1张图片

 

pcDuino: miniPC Arduino 触摸传感器模块的连接器套件 例程_第2张图片

 Now we can add Arduino shield.

We use Linker kit in this tutorial:

 

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.

 Code:

 ubuntu@ubuntu :~/arduino/test$ more touch_sen.c

/*
* 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

void setup()
{

pinMode(led_pin, OUTPUT);
pinMode(btn_pin, INPUT);
}

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

 

你可能感兴趣的:(arduino,minipc,迷你电脑,性能远超树莓派)