add ir send nodejs

This commit is contained in:
Shannon 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,6 +168,9 @@ void sendRCTristate (uint8_t val[], int pin) {
} }
void irSend(int type, int length, unsigned long val) { 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++) { for(int i = 0; i < 3; i++) {
switch (type) { switch (type) {

View file

@ -19,7 +19,7 @@ router.get('/toggleLight', function (req, res) {
}); });
router.get('/irTest', 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'); res.send('switch light');
}); });