• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32: Unit6: ESP32 with PIR Motion Sensor – Interrupts and Timers

Q&A Forum › Category: ESP32 › ESP32: Unit6: ESP32 with PIR Motion Sensor – Interrupts and Timers
1 Vote Up Vote Down
Gayrat Vlasov asked 7 years ago

The code, working with interrupt need some correction.

You attach detectsMovement function as interrupt handler and declare it:
void detectsMovement() {...}

But correct code must be:
void IRAM_ATTR detectsMovement() {...}

IRAM_ATTR need for place interrupt code to RAM, otherwise code stored in flash

More text in this link:
https://www.esp32.com/viewtopic.php?t=4978

Please, correct your code

1 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 7 years ago

Hi! Thanks for the great tip.

I’ve just tried it myself and read about it, it’s definitely faster and better method.

I’ve updated the online version of the course: https://rntlab.com/esp32-with-pir-motion-sensor-interrupts-and-timers/ (ESP32 with PIR Motion Sensor)

The eBook will have that change too in the next update.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.