Page 1 of 1

Digital Input

Posted: Wed Oct 16, 2019 8:11 pm
by fabltd
Hello All

I have a 868Mhz Radio connected to GPIO 14.

The transmitter ( handheld remote) sends a Logic 1 as a 0.88 MS Pulse and logic 0 as 0.44 Pulse.

I have tried every thing I can think of but I cannot seem to read the port quickly enough. I fail to detect the Logic pulses.

The transmitter uses a Sync bit ( Logic 1) of 2.6 MS this can be detected.

I have attached a change Interrupt and with in the ISR I have the following code:

Code: Select all

  void IRAM_ATTR ISR(){
  unsigned long timestamp = micros();
  unsigned long pulse_width = timestamp - last_timestamp;
  int pin = digitalRead(14);
  last_timestamp = timestamp;
  last_pulse_width = pulse_width;
  update = true;
  void loop(){
  if (change){
  change = false;
Is there a better way to read the pin so that I can detect the fast pulses. Help :D


Re: Digital Input

Posted: Thu Oct 17, 2019 7:35 am
by rodmcm
Have you tried something simple like a print statement in the interrupt routine to see if it's working?


Re: Digital Input

Posted: Thu Oct 17, 2019 7:38 am
by rodmcm
I should have read your code better

You have to attach the interrupt to Pin 14 in the setup, not call it in the Interrupt routine
attachInterrupt( , ,)
ESP32 with PIR Motion Sensor using Interrupts and Timers