0
0
Arduinoprogramming~10 mins

Rising, falling, and change triggers in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to attach an interrupt that triggers on a rising edge.

Arduino
attachInterrupt(digitalPinToInterrupt(2), handleInterrupt, [1]);
Drag options to blanks, or click blank then click option'
ARISING
BCHANGE
CFALLING
DLOW
Attempts:
3 left
💡 Hint
Common Mistakes
Using FALLING instead of RISING will trigger on the opposite edge.
Using CHANGE triggers on both edges, not just rising.
2fill in blank
medium

Complete the code to attach an interrupt that triggers on a falling edge.

Arduino
attachInterrupt(digitalPinToInterrupt(3), interruptHandler, [1]);
Drag options to blanks, or click blank then click option'
AFALLING
BRISING
CHIGH
DCHANGE
Attempts:
3 left
💡 Hint
Common Mistakes
Using RISING instead of FALLING triggers on the opposite edge.
Using HIGH is not a valid interrupt mode.
3fill in blank
hard

Fix the error in the interrupt mode to trigger on any change.

Arduino
attachInterrupt(digitalPinToInterrupt(4), onChange, [1]);
Drag options to blanks, or click blank then click option'
AFALLING
BCHANGE
CRISING
DLOW
Attempts:
3 left
💡 Hint
Common Mistakes
Using RISING or FALLING triggers only one edge, not both.
Using LOW triggers level-sensitive (while low), not on edges.
4fill in blank
hard

Fill both blanks to create arrays that map pins to interrupt modes for rising and falling triggers.

Arduino
const int pins[] = {2, 3};
const int modes[] = { [1], [2] };
Drag options to blanks, or click blank then click option'
ARISING
BFALLING
CCHANGE
DLOW
Attempts:
3 left
💡 Hint
Common Mistakes
Using CHANGE for both pins triggers on any change, not specific edges.
Using LOW is invalid for edge-triggered interrupts in this context.
5fill in blank
hard

Fill all three blanks to create a map of pins to interrupt modes and attach interrupts accordingly.

Arduino
const int pins[] = {5, 6, 7};
const int modes[] = { [1], [2], [3] };

for (int i = 0; i < 3; i++) {
  attachInterrupt(digitalPinToInterrupt(pins[i]), interruptHandlers[i], modes[i]);
}
Drag options to blanks, or click blank then click option'
ACHANGE
BRISING
CFALLING
DLOW
Attempts:
3 left
💡 Hint
Common Mistakes
Using CHANGE mode for all pins triggers on any change, not specific modes.
Forgetting that all listed modes (LOW, CHANGE, RISING, FALLING) are valid.