Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1) Convert the following pseudo code to an arduino program: Part 2) Change the program to decrement encoderPostion every time the push-button is pressed.
Part 1) Convert the following pseudo code to an arduino program:
Part 2) Change the program to decrement encoderPostion every time the push-button is pressed. Insure that only one decrement occurs per button press.
The structure of the interrupt routines for handling the encoders are included below. The test of the encoders and our code will be to simply display the encoder value every 0.1 seconds Functions Needed: attachlnterrupt Interrupt, ISR. mode ) Program Structure: Global Variable encoderPosition Interrupt service routines. void MonitorA0 if input A and input B are equal input A and input B are pins 2 and 3 respectively Increment encoderPosition. else Decrement encoderPosition void MonitorBO if input A and input B are equal Decrement encoderPosition. Note this is the opposite of what happens above! else Increment encoderPosition. SetUp: Attach MonitorA to interrupt 0, (Pin 2) and set mode for any change Attach MonitorB to interrupt 1, (Pin 3) and set mode for any change. Loop ds display encoderPosition on LCD screen. Lab Assignment: Prelab: Write the program described in the program section. The structure of the interrupt routines for handling the encoders are included below. The test of the encoders and our code will be to simply display the encoder value every 0.1 seconds Functions Needed: attachlnterrupt Interrupt, ISR. mode ) Program Structure: Global Variable encoderPosition Interrupt service routines. void MonitorA0 if input A and input B are equal input A and input B are pins 2 and 3 respectively Increment encoderPosition. else Decrement encoderPosition void MonitorBO if input A and input B are equal Decrement encoderPosition. Note this is the opposite of what happens above! else Increment encoderPosition. SetUp: Attach MonitorA to interrupt 0, (Pin 2) and set mode for any change Attach MonitorB to interrupt 1, (Pin 3) and set mode for any change. Loop ds display encoderPosition on LCD screen. Lab Assignment: Prelab: Write the program described in the programStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started