Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your health club has something called the 30 Minute Workout which consists of several machines and step stations that you complete in order. On the

Your health club has something called the 30 Minute Workout which consists of several machines and step stations that you complete in order. On the wall are two lights, one red and one green, which indicate how much time you should spend at each station. However, the lights are on a fixed cycle and some patrons find the time between cycles either too long or too short. The health club has asked you to design an ATmega328-controlled system that can be installed at each station. It works as follows: the red light is on until the user presses a button to start. Once the button is pressed, the green light goes on for 60 seconds. After 60 seconds, the green light turns off and the red light turns on until the next time the button is pushed. You think this is going to be easy until you realize that the longest delay you can get from Timer1 is around 4 seconds. You ask your professor for help and she suggests that instead of delaying 60 seconds at once, you can delay 4 seconds 15 times. She indicates that the easiest way to do this is to set up timer1 for a 4 second interrupt and then update a counter in the ISR. The main loop monitors the button for a push, controls the red and green lights and monitors the counter to know when to turn them on and off. Write the program to control the station lights for the 30 Minute Workout using register programming. You may not use any ArduinoC instructions because the code needs to be portable to any ATmega328 platform. See lecture 9 and the lecture 9 activity solution for more information on timer interrupts. *note when a variable is updated in an ISR and read in the main loop, it should be declared as volatile. If not, the compiler may deem it unnecessary and optimize it out. Ex: volatile int counter =

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_2

Step: 3

blur-text-image_3

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

Why are postaudits important to the efficiency of a business?

Answered: 1 week ago