Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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 program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago