Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make code in Arduino for this scenario. Here's what I have so far. #include myDuino robot(1); int button1; int button2; int work = robot.encoderDir();

Please make code in Arduino for this scenario. Here's what I have so far.

#include myDuino robot(1); int button1; int button2; int work = robot.encoderDir(); void encHandler() { robot.doEncoder(); } void setup() { attachInterrupt(digitalPinToInterrupt(2), encHandler, CHANGE); attachInterrupt(digitalPinToInterrupt(3), encHandler, CHANGE); } void loop() {image text in transcribed

Connect the rotary encoder, a DC motor and two momentary switches (long-arm or roller) to the Arduino development board. Use the readings from the encoder to control the duty cycle of the PWM signal to the DC motor. Each full rotation of the encoder should correspond to a 10% change in duty cycle (0100). In other words, if the program is started and then the encoder is turned one full rotation, the motor should be running at 10% duty cycle; after 10 rotations, the motor should be running at full speed. While one switch is held down, the motor should spin clockwise. While the other is held down, the motor should spin counterclockwise. When both or neither switches are held, the motor should not turn at all. Additionally, use the LEDs on the development board to indicate the direction of travel of the motor. One LED should illuminate when the motor is traveling CW and the other when the motor is traveling CCW

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions