ESPiLight
ESPiLight copied to clipboard
Doesn't work with TTGO T-Call (ESP32)
Hi! I try to use ESPiLite c TTGO T-Call (ESP32) and srx882, but unfortunately nothing works, there is no answer at all. Although the same code works on The Wemos D1 mini. Tried different pins, different code, but all the same does not work.
#define RECEIVER_PIN 27
#define TRANSMITTER_PIN -1
#include <ESPiLight.h>
ESPiLight rf(TRANSMITTER_PIN);
String getValue(String id, String message) {
String value = "";
int idIndex = message.indexOf('"' + id + '"' + ':');
if (idIndex != -1) {
int valueIndex = idIndex + id.length() + 3;
value = message.substring(valueIndex, message.indexOf(",", valueIndex));
}
return value;
}
void rfCallback(const String &protocol, const String &message, int status, int repeats, const String &deviceID) {
if (status == VALID && protocol.equals("arctech_screen_old")) {
String t = getValue("unit", message);
// Blynk.virtualWrite(V0, t);
Serial.println("unit: " + t);
String h = getValue("state", message);
Serial.println("state: " + h);
// Blynk.virtualWrite(V1, h);
}
Serial.println("rfCallback ends");
}
void setup() {
Serial.begin(115200);
rf.setCallback(rfCallback);
rf.initReceiver(RECEIVER_PIN);
}
void loop() {
rf.loop();
}
Spent four days finding the problem! Finally found, as the documentation says:
https://github.com/espressif/esp-idf/tree/f91080637/examples/peripherals/pcnt
- GPIO4 is the default output GPIO of the 1 Hz pulse generator.
- GPIO18 is the default pulse input GPIO. We need to short GPIO4 and GPIO18.
- GPIO5 is the default control signal, which can be left floating with internal pull up, or connected to Ground (If GPIO5 is left floating, the value of counter increases with the rising edges of the PWM pulses. If GPIO15 is connected to Ground, the value decreases).
After connecting to pin 18, everything worked!