AdSense

2013年6月25日火曜日

Arduinoと赤外線LEDでPanasonicのテレビをリモコン操作できた

Arduinoと赤外線LEDでPanasonicのテレビをリモコン操作できた。
シリアルで任意のコマンド送信。
btn1Zとか(Zはコマンド末尾の意)

------------------------------------------------
#include <HashMap.h>
#include <IRremote.h>

IRsend irsend;
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

#define PanasonicAddress 0x4004   // Panasonic address (Pre data)

const byte HASH_SIZE = 30;
HashType<String,long> hashRawArray[HASH_SIZE];
HashMap<String,long> hashMap = HashMap<String,long>( hashRawArray , HASH_SIZE );

void setup() {
    sethashMap();
    Serial.begin(9600);  // 9600bpsでシリアルポートを開く
    irrecv.enableIRIn();  // Start the receiver
}
char a;

void loop() {
    char str[20]; // 数字(文字列)の受信用配列
    String s;

    recvStr(str);
    s = str;
    long a = atol(str);
    Serial.println(s);
 
    for (int i = 0; i < 3; i++) {
      //irsend.sendPanasonic(0x4004, 0x1008485);
      irsend.sendPanasonic(PanasonicAddress, hashMap.getValueOf(s));

      delay(40);
    }
    irrecv.enableIRIn(); // Start the receiver
 
    if (irrecv.decode(&results)) {
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
    }
}

void recvStr(char *buf)
{
  int i = 0;
  char c;

  while (1) {
    if (Serial.available()) {
      c = Serial.read();
      buf[i] = c;
      if (c == 'Z') {
        buf[i] = '\0';
        break; // 文字列の終わりはZで判断
      }
      i++;
    }
  }
}

void sethashMap(){
hashMap[0]("btn1" ,0x1900697);
hashMap[1]("btn2" ,0x1908617);
hashMap[2]("btn3" ,0x19046D7);
hashMap[3]("btn4" ,0x190C657);
hashMap[4]("btn5" ,0x19026B7);
hashMap[5]("btn6" ,0x190A637);
hashMap[6]("btn7" ,0x19066F7);
hashMap[7]("btn8" ,0x190E677);
hashMap[8]("btn9" ,0x1901687);
hashMap[9]("btn10" ,0x1909607);
hashMap[10]("btn11" ,0x19056C7);
hashMap[11]("btn12" ,0x190D647);
hashMap[12]("chaUp" ,0x1002C2D);
hashMap[13]("chaDown" ,0x100ACAD);
hashMap[14]("volUp" ,0x1000405);
hashMap[15]("volDown" ,0x1008485);
hashMap[16]("power" ,0x100BCBD);
hashMap[17]("degital" ,0x1402E6F);
hashMap[18]("BS" ,0x1400E4F);
hashMap[19]("CS" ,0x140AEEF);
hashMap[20]("keyUp" ,0x1005253);
hashMap[21]("keyRig" ,0x100F2F3);
hashMap[22]("keydown" ,0x100D2D3);
hashMap[23]("keyLef" ,0x1007273);
hashMap[24]("Set" ,0x1009293);
hashMap[25]("back" ,0x1002B2A);
hashMap[26]("blue" ,0x100CECF);
hashMap[27]("red" ,0x1000E0F);
hashMap[28]("yellow" ,0x1008E8F);
hashMap[29]("green" ,0x1004E4F);
}


2013年1月27日日曜日

Android 4.2.1 JerryBeans on PandaBoard ES


Android 4.2.1 JerryBeans on PandaBoard ESを実施。

http://blog.sola-dolphin-1.net/archives/4334161.html


上記手順に従いUbuntu11 64bitでビルドするもビルドエラーになる。

環境をUbuntu12 64bitに変更して実施することで問題無くビルドOK

動作確認結果
・Wifi
・BT
・音
・HDMI出力

などなど、問題なし。