so exicted to verify the IR unit is working on AtomLite
-
I think I have spent hours to hours to verify the IR unit, it keeps not working as expected on UIFlow and MicroPython, but tonight I tried Arduino, althrough I can not pronounce it correctly and can not remember the weird name, it shows to me the IR unit can receive single from a fan remote!!!
I want to share the working code here
Notes: this example code is copied from here, and it's target to M5Stack instead of M5Atom, so the default RECV PIN is 36, but for the M5Atom, you should use 32 as the default RECV PIN, the default means connecting IR unit via the HY2.0-4P cable.
#include <M5Stack.h> int ir_recv_pin = 32; int ir_send_pin = 26; int last_recv_value = 0; int cur_recv_value = 0; void setup() { M5.begin(); M5.Power.begin(); pinMode(ir_recv_pin, INPUT); pinMode(ir_send_pin, OUTPUT); digitalWrite(ir_send_pin, 1); } void loop() { cur_recv_value = digitalRead(ir_recv_pin); if (last_recv_value != cur_recv_value) { if (cur_recv_value == 0) { // 0: detected 1: not detected Serial.println("detected"); } last_recv_value = cur_recv_value; } Serial.println(cur_recv_value); }
-
@dawncold cool. I'm just trying to get the IR to work as well on the ATOM or M5. Well I only have M5 for now with IR. Do you know how that might work on M5 as there are no pins?
You also exposed the issue I'm having is that my code base uses M5Stack.h and all these other libraries, like M5Atom don't work nicely together (different pin numbers for same name, etc). Outside of the complicated M5United, it sure seems the M5 community could do a better way of separating their libraries and not overload M5. I'm still stuck on the M5Core2 merge with M5Stack.
thanks. -
what's your M5 device?
-
I have almost all of them but in this case the M5Stick CPlus. It says IR is G9.