Question: Write a code for the following (C, arduino nano) Program Structure: Global Variable encoderPosition // Interrupt service routines. void MonitorA() if input A and input

Write a code for the following (C, arduino nano)

Program Structure: Global Variable encoderPosition // Interrupt service routines. void MonitorA() if input A and input B are equal // input A and input B are pins 2 and 3 respectively. Decrement encoderPosition. else Increment encoderPosition. void MonitorB() if input A and input B are equal Increment encoderPosition. // Note this is the opposite of what happens above! else Decrement encoderPosition. SetUp: Attach MonitorA to interrupt 0, and set mode for any change. Attach MonitorB to interrupt 1, and set mode for any change. Loop: Every 100 milliseconds display encoderPosition on LCD screen.

Functions needed: attachInterrput( Interrupt, ISR, mode);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!