add ir send nodejs

This commit is contained in:
Stefan Sterz 2016-01-28 16:42:06 +01:00
parent cb9e5fc361
commit 6c017889e9
2 changed files with 5 additions and 2 deletions

View File

@ -168,7 +168,10 @@ void sendRCTristate (uint8_t val[], int pin) {
}
void irSend(int type, int length, unsigned long val) {
char m[22];
sprintf(m, "%04d::%04d::%09lu", type,length,val);
Serial.println(m);
for(int i = 0; i < 3; i++) {
switch (type) {
case RC5: irsend.sendRC5(val, length); break;

View File

@ -19,7 +19,7 @@ router.get('/toggleLight', function (req, res) {
});
router.get('/irTest', function (req, res) {
arduino.write(new Buffer('Y0000000' ,'ascii'));
arduino.write(new Buffer('X' + String.fromCharCode(4) + String.fromCharCode(12) + String.fromCharCode(0)+String.fromCharCode(0)+String.fromCharCode(2689 / 256) + String.fromCharCode(2689 % 256),'ascii'));
res.send('switch light');
});