Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with TTGO T-Call (ESP32) #47

Open
Terxeno opened this issue Feb 7, 2020 · 1 comment
Open

Doesn't work with TTGO T-Call (ESP32) #47

Terxeno opened this issue Feb 7, 2020 · 1 comment

Comments

@Terxeno
Copy link

Terxeno commented Feb 7, 2020

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();
}

@Terxeno Terxeno changed the title Doesn't work with TTGO T-Call Doesn't work with TTGO T-Call (ESP32) Feb 13, 2020
@Terxeno
Copy link
Author

Terxeno commented Feb 13, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant