Closed wgcv closed 6 years ago
I don't have a receiver at the moment to test. @ArthurMa1978 can you comment on this?
For example I'm using LG controller With the arduino and IRremote i get this:
20DF10EF
Decoded NEC: 20DF10EF (32 bits)
Raw (68): 9050 -4450 600 -500 600 -500 600 -1650 600 -550 600 -500 600 -500 600 -550 600 -500 600 -1650 600 -1650 600 -500 600 -1650 600 -1650 600 -1600 650 -1600 600 -1650 650 -450 650 -500 600 -500 600 -1650 600 -500 650 -500 600 -500 650 -500 600 -1600 650 -1600 600 -1650 650 -450 600 -1650 650 -1600 600 -1650 600 -1650 600
But if i use
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
// To get started please visit https://microsoft.github.io/azure-iot-developer-kit/docs/projects/connect-iot-hub?utm_source=ArduinoExtension&utm_medium=ReleaseNote&utm_campaign=VSCode
#include "AZ3166WiFi.h"
#include "AzureIotHub.h"
#include "DevKitMQTTClient.h"
#include "config.h"
#include "utility.h"
#include "SystemTickCounter.h"
#include "Sensor.h"
IRDASensor *IrdaSensor;
static unsigned char counter;
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Arduino sketch
void setup()
{
Screen.init();
Screen.print(0, "IoT DevKit");
IrdaSensor = new IRDASensor();
IrdaSensor->init();
}
void loop()
{
counter = 0x20DF10EF;
for (int i = 0; i < 3; i++) {
int irda_status = IrdaSensor->IRDATransmit(&counter, 32, 100 );
delay(1000);
}
}
The arduino doesn't read any code. I think that is a problem with the encode (IRremote encode with NEC) and IrdaSensor->IRDATransmit only send plain. (Also i don't know what is size and timeout; and pdata is ok like 0x20DF10EF?)
As my answers in the gitter: The code is not correct. Here the counter is unsigned char, so it will be truncated if you assign 0x20DF10EF to this variable. And the second parameter is the size of the buff in byte, nit bit. So the right code is just like:
static unsigned char counter[] = { 0x20, 0xDF, 0x10, 0xEF };
int irda_status = IrdaSensor->IRDATransmit(counter, sizeof(counter), 100);
@ArthurMa1978 thanks for the help. closing for now
Thanks @ArthurMa1978 !
Can I ask a quick question - Did you manager to get the IR signal emitting with the code/changes above?
I have just bought the az3166 and using the code above although my irda_status is returning 0 I cant be sure that its emitting the right codes. I have ordered an IR reciever to check but was interested in whether you got this working? as there isn't much info available online!
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
how i send in AZ?
But I don't know if the protocol is ok? Because doesn't work.