Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is written in c++ You are to create a new application that will execute on your Arduino platform. Your application will repeatedly convert an

This is written in c++

image text in transcribed

image text in transcribed

You are to create a new application that will execute on your Arduino platform. Your application will repeatedly convert an analog voltage connected to analog pin A0 to its corresponding digital value. Your code is required to perform the conversion using the analogRead function, and the time required for each conversion and the resulting digital value from the conversion must be displayed to the screen using the serial monitor. The analog signal to be converted is a voltage from 0 to +5V that is adjustable via the potentiometer. Be careful with analog values > 5.0 V as they can damage the ADC. Upon power up or reset, your code will start by displaying a reset message. Then, it will display a prompt to the screen asking the user for a 'c' to start a set of conversions. When the user enters a 'c', your program should display a message to the screen that a series of 30 measurements is about to begin. Your code should then convert the analog input 30 times (make sure you are waiting long enough between conversions). For each conversion, your code should display the number of the conversion, the resulting digital value in hexadecimal), and the required conversion time. After the 30th conversion is complete, the average time required for the 30 conversions should be displayed and the program should prompt the user to begin another set of conversions. The only valid user input at the prompt is c'. All other user inputs are considered erroneous and should be accounted for appropriately. All user inputs entered during a set of conversions should be ignored. All user inputs (valid and invalid) should reset a watchdog timer. If the user does not provide any inputs within 4 seconds, the watchdog timer should expire and the board should reset. The timeout period should begin upon prompt to the user for input. Students are required to use the hardware watchdog timer for this assignment (must configure the hardware directly, you cannot use any form of delay function based upon the watchdog timer). Sample program output: Board was reset Enter c' to start a set of conversions > (user enters 'c") Starting a set of conversions: #1: digital value = 3FF Time = 120 secs #2: digital value = 3A0 Time = 118 usecs (all user inputs during conversions are ignored) #30: digital value = 000 Time = 120 secs avg conversion time = 120.00 usecs Enter 'e' to start a set of conversions > (user enters 'x') Error: invalid user input the only valid user input is 2 Enter c' to start a set of conversions > (user enters nothing for > 4 seconds) Board was reset Enter 'c' to start a set of conversions >

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions