If you are asking a question, please follow this template:
- My goal is:
Is to transmit and receiver IR codes from one another device. Like transmit Command and get response. - My actions are:
https://mongoose-os.com/docs/mongoose-os/api/net/ir.md
from this I am using
Just to run Example code
//---------------------RX code----------------
#include <stdio.h>
#include "mgos.h"
#include "mgos_ir.h"
#include "mgos_gpio.h"
//int r1=16; //for esp8266
int r1=2; //for esp32
bool r1_S=false;
int bufcode=0;
static void timer_cb(void *arg) {
LOG(LL_INFO, ("bfcode is %d",bufcode ));
(void) arg;
}
static void irrecv_cb(int code, void *arg)
{
// LOG(LL_INFO, ("IR: %08X", code)); // as I am using ESP32 -- error Core dump
bufcode=code;
mgos_gpio_toggle(r1);
(void) arg;
}
void ConfigMyGPIO()
{
mgos_gpio_set_mode(r1, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write(r1,0);
LOG(LL_INFO, ("GPIO COnfig"));
}
enum mgos_app_init_result mgos_app_init(void)
{
ConfigMyGPIO();
// TSOP on pin 14, NEC protocol
LOG(LL_INFO, ("started"));
mgos_irrecv_nec_create(14, irrecv_cb, NULL);
mgos_set_timer(1000 /* ms */, true /* repeat */, timer_cb, NULL);
return MGOS_APP_INIT_SUCCESS;
}
//---------------------TX code----------------
#include "mgos.h"
#include "mgos_ir.h"
#include "mgos_gpio.h"
int r1=4;
int IR_pin=2;
bool r1_S=false;
bool a=true;
static void timer_cb(void *arg)
{
a=!a;
mgos_irsend_nec(IR_pin,135484,a/*fot tsop*/);
LOG(LL_INFO, ("sent "));
mgos_gpio_toggle(r1);
}
void ConfigMyGPIO()
{
mgos_gpio_set_mode(r1, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_set_mode(IR_pin, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write(r1,1);
LOG(LL_INFO, ("GPIO COnfig"));
}
enum mgos_app_init_result mgos_app_init(void)
{
ConfigMyGPIO();
// TSOP on pin 14, NEC protocol
LOG(LL_INFO, ("started"));
// TSOP on pin 14, NEC protocol
mgos_set_timer(2000 /* ms */, true /* repeat */, timer_cb, NULL);
return MGOS_APP_INIT_SUCCESS;
}
- The result I see is:
Not getting any reprocess. - My expectation & question are:
Special Thanks to mongoose team. Its very very useful for product development.
we have developed product based on AWS iot core.
Now we want to connect devices with IR. We are trying IR communication. using your lib.
case 1 - I use code of https://github.com/crankyoldgit/IRremoteESP8266/
lib for ESP32 without mongoose os.
It receives IR code transmitted by IR transmitter( with mongoose os).
but get different code every time… Like sometime i get 32 bit code, Sometimes 35bit, even 72bit. code.
I used my TV remote as a transmitter, It works god.
case2- RX TX code with mongoose os IR lib, I dint get any IR code at receiver side though transmitter is transmitting(checked by 1.camera and by sample IR receiver code from https://github.com/crankyoldgit/IRremoteESP8266/.
Comment : Woks good - IR transmitter (with mongoose os) --> IR receiver with IRremoteESP8266/. lib
Works good with - IR receiver (with Mongoose os) – > IR Transmitter with IRremoteESP8266/. lib .
but Not both RX TX with mongoose os IR lib.
Please give your valuable inputs.