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
Get step-by-step solutions from verified subject matter experts
