microsoft / azure-iot-developer-kit

A curated list of awesome Azure IoT Developer Kit projects and resources.
MIT License
95 stars 58 forks source link

IrDa send information #429

Closed wgcv closed 5 years ago

wgcv commented 6 years ago

Hi I'm checking the IRremote library for arduino but doesn't work with the az3166; also I'm checking the documentation (https://microsoft.github.io/azure-iot-developer-kit/docs/apis/irda/) but I don't know how to send a infrared command with *char .

For example in arudino with IRremote is like this

irsend.sendNEC(0xFFE896, 32);

how i send in AZ?

unsigned char powerOn2 = 0xFFE896;
IRDASensor *IrdaSensor;
setup(){
IrdaSensor = new IRDASensor();
IrdaSensor->init();
}
loop() {
int irda_status = IrdaSensor->IRDATransmit(&powerOn, 1, 100 );
if(irda_status != 0)
{
Serial.println("Unable to transmit through IRDA");
}
}

But I don't know if the protocol is ok? Because doesn't work.

ArthurMa1978 commented 5 years ago

include "IrDASensor.h"

static unsigned char powerOn2[] = { 0xFF, 0xE8, 0x96 }; static int initied = -1; static IRDASensor *irda = NULL;

void setup() { if ((irda = new IRDASensor()) != NULL) { initied = irda->init(); } }

void loop() { if (initied == 0) { int irda_status = irda->IRDATransmit(powerOn2, 3, 100 ); Serial.printf("IrDA data sent, return %d\r\n", irda_status); } wait(1); }