インテル ガリレオを使ってみる – 標準でついているタッチセンサーを使う –

スポンサーリンク

サンプル見たらありました
https://communities.intel.com/docs/DOC-22272の「Samples of how to run Linux Commands via IDE」をダウンロードし展開するとあります

インテル ガリレオのボード上にAD7298というセンサが標準でついていて、そのセンサに温度測定機能があるようです。

サンプル中の”Linux_QuarkTouchSensor\Linux_QuarkTouchSensor.ino””が標準で付いているセンサで気温を測定するArduinoスケッチ(インテル ガリレオで電子工作をするときのプログラム)のようです

中身は

/*
This example takes advantage of the fact that the SoC temperature 
drops by a few degrees when you touch it- use the Quark SoC as a 
touch sensor!

Example code by Erik Nyquist 2013;
erik.nyquist@intel.com

I do not hold any rights over these 
code examples, and you may do with 
them what you wish
*/

char temp_raw[6];
int temp;
int check = 1;
int initialTemp;


void setup() {
  
  Serial.begin(115200);
  Serial.println("Touch Quark to start.");
  initialTemp = getQuarkTemp();

}

void loop() {
  temp = getQuarkTemp();
  if (temp < initialTemp - 2 && check == 1){
    
    Serial.println("Touch!");
    check = 0;
    delay(500);
    
  }
  
  if (temp > initialTemp - 1 && check == 0){
    check = 1;
  }
    
  
}

int getQuarkTemp(){
 
  FILE *fp;
 
  fp = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); 
  fgets(temp_raw, 5, fp);
  fclose(fp);
  
  int temp = atoi(temp_raw);
  temp /= 100;
  return temp;  
  
}

上のプログラムを実行すると、インテル ガリレオでタッチセンサが使えるかと思います(^O^)

ただし、温度を感知することでのタッチセンサのようです

上のプログラム中に

This example takes advantage of the fact that the SoC temperature
drops by a few degrees when you touch it- use the Quark SoC as a
touch sensor!

とあり、ざっと訳すと
これはSoCの温度測定機能を使っている。Socに指でタッチするとSocの温度が少し低くなる、つまりSocの温度が少し低くなる=指でタッチした時、とみなしてタッチセンサとして使うことができるよ!
とあります。そういう感じのタッチセンサとして使えるみたいです