5回答

1收藏

Touch Sensor Module of Linker Kit on pcDuino

其他 其他 3685 人阅读 | 5 人回复 | 2013-03-15

本帖最后由 xinxincaijq 于 2013-3-15 14:15 编辑

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.


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.
http://player.youku.com/player.php/sid/XNTI3MTA5MjU2/v.swf
Code:

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

  2. /*
  3. * Touch Sensor module of Linker Kit for pcDuino
  4. * http://linksprite.com/wiki/index.php5?title=Touch_Sensor_Module
  5. */
  6. #include "core.h"
  7. int led_pin = 8; //Connect LED module to GPIO 8
  8. int btn_pin = 7; //Connect touch module to GPIO 7

  9. void setup()
  10. {

  11. pinMode(led_pin, OUTPUT);
  12. pinMode(btn_pin, INPUT);
  13. }

  14. void loop()
  15. {
  16. int value = digitalRead(btn_pin); // get button status

  17. if ( value == HIGH ) // button pressed
  18. {
  19. digitalWrite(led_pin, HIGH); // turn on LED
  20. }
  21. else // button released
  22. {
  23. digitalWrite(led_pin, LOW); // turn off LED
  24. }
  25. delay(100);
  26. }
复制代码
分享到:
回复

使用道具 举报

回答|共 5 个

倒序浏览

沙发

ming1006

发表于 2013-3-15 22:18:42 | 只看该作者

话说怎么感觉从视频里看不到灯亮呢
板凳

小菜儿

发表于 2013-3-15 22:50:13 | 只看该作者

ming1006 发表于 2013-3-15 22:18
话说怎么感觉从视频里看不到灯亮呢

视频中灯在下方,灯光不是太明显,与拍摄环境有关系!
地板

小菜儿

发表于 2013-3-15 22:50:23 | 只看该作者

ming1006 发表于 2013-3-15 22:18
话说怎么感觉从视频里看不到灯亮呢

视频中灯在下方,灯光不是太明显,与拍摄环境有关系!
5#

ming1006

发表于 2013-3-15 23:02:22 | 只看该作者

xinxincaijq 发表于 2013-3-15 22:50
视频中灯在下方,灯光不是太明显,与拍摄环境有关系!

又看了一遍,终于看到了
6#

aaa_3002076

发表于 2013-3-19 13:35:57 | 只看该作者

少看电影多看教学视频。屌丝男华丽变成高富帅。。。。。
您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条