Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
10
  • You attach interrupts quite often which I’d say is uncommon at least. I don‘t know what attachInterrupt() does in the background, but if it uses dynamic memory allocation I could imagine that calling it frequently might lead to problems. Commented Jan 28, 2020 at 14:42
  • Also you should not return from the main (loop) function on a uC. I don‘t know if it‘s legal, but it doesn‘t make much sense Commented Jan 28, 2020 at 14:44
  • @SimSon: 1. attachInterrupt() does no memory allocation. 2. loop() is not main(): returning from loop() is perfectly fine, and expected. Commented Jan 28, 2020 at 14:47
  • @EdgarBonet good to know! Will it be like while(1) loop(); in the end? Commented Jan 28, 2020 at 14:50
  • @SimSon: main() does indeed call loop() repeatedly. Commented Jan 28, 2020 at 14:54

AltStyle によって変換されたページ (->オリジナル) /