Suppose you have an inexpensive noisy mechanical switch that you wish to monitor using your STM32....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Suppose you have an inexpensive noisy mechanical switch that you wish to monitor using your STM32. Normally you would use a simple Digital Input for this. However in this case, you chose to use both a digital input and an analog input so that you can observe the noisy behavior of the switch. Assume it is a simple2 terminal switch where one terminal is grounded (so grounded when closed) and you are measuring the other terminal. The objective of this question is to poll the switch every 1ms and see how the values of the digital read relate to the values read by the analog read. 1. Setup a new project in PlatformIO, using MBED and your STM32F429 board. 2. Using the MBED framework, set up 3 GPIOS (don't forget any required configurations): a. One analog IN (to read the switch) b. On digital IN (to read the switch) c. One digital OUT (connected to either an on-board LED or an external LED) 3. Using the Timer HAL provided by MBED (timer, ticker, timeout etc.) set up a recurring function call that runs every 1ms that will read the switch state on both analog and digital inputs 4. Write a short algorithm that you will use to determine if the switch is open or closed, by reading the analog input only. 5. Compare the output of the algorithm in 4. with the value read from the digital input. If the values match, leave the LED (digital OUT) OFF. 6. If the values from 4. and that read from the digital IN differ, then light up the LED. 7. Essentially, when you run the code, the LED will only light up if the two values differ meaning that the switch value is unreliable. 8. Submit your main code file. Suppose you have an inexpensive noisy mechanical switch that you wish to monitor using your STM32. Normally you would use a simple Digital Input for this. However in this case, you chose to use both a digital input and an analog input so that you can observe the noisy behavior of the switch. Assume it is a simple2 terminal switch where one terminal is grounded (so grounded when closed) and you are measuring the other terminal. The objective of this question is to poll the switch every 1ms and see how the values of the digital read relate to the values read by the analog read. 1. Setup a new project in PlatformIO, using MBED and your STM32F429 board. 2. Using the MBED framework, set up 3 GPIOS (don't forget any required configurations): a. One analog IN (to read the switch) b. On digital IN (to read the switch) c. One digital OUT (connected to either an on-board LED or an external LED) 3. Using the Timer HAL provided by MBED (timer, ticker, timeout etc.) set up a recurring function call that runs every 1ms that will read the switch state on both analog and digital inputs 4. Write a short algorithm that you will use to determine if the switch is open or closed, by reading the analog input only. 5. Compare the output of the algorithm in 4. with the value read from the digital input. If the values match, leave the LED (digital OUT) OFF. 6. If the values from 4. and that read from the digital IN differ, then light up the LED. 7. Essentially, when you run the code, the LED will only light up if the two values differ meaning that the switch value is unreliable. 8. Submit your main code file.
Expert Answer:
Answer rating: 100% (QA)
Here is a possible solution for your task 1 To set up a new project in PlatformIO you can follow the steps in this guide1 You need to select the MBED framework and the STM32F429 board from the options ... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these accounting questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Assume that the average talk time on an Apple iPhone is 20 hours and that this time follows the exponential probability distribution. What is the probability that a randomly selected iPhone will...
-
Modify your bits.html page from Exercise 7.4 so that it uses a function to encapsulate the statements for accessing the number of bits, calculating the number of values, and displaying it in the...
-
Find the temperature distribution T(x, y) and the complex potential F(z) in the given thin metal plate whose faces are insulated and whose edges are kept at the indicated temperatures or are...
-
Golden Sun Bakery mass-produces bread using three sequential processing departments: Mixing, Baking, and Packaging. The following transactions occurred during April: Requirements: 1. Post each of...
-
Paper Company acquired 80 percent of Scissor Company's outstanding common stock for $296,000 on January 1, 20X8, when the book value of Scissor's net assets was equal to $370,000. Problem 3-37...
-
Which OSI layer is responsible for connection - oriented communication?
-
You are a senior accountant in a top-tier accounting firm. Your senior manager has asked you to assist your client, Daisy Ltd, in the preparation of consolidated financial statements for the year...
-
John is evaluating the idea to open an ice cream shop on a piece of land. The followings are what he might include in the cash flows: . Instead, John can earn $120,000 if he decides to sell the land...
-
On1July2021,GiHun,aresidenttaxpayeraged31,travelledtoSouth Ioreawhereheworkedcontinuouslyfor9monthsasacharitable worker by a recognised non-government organisation aid worker before...
-
and errore extraordinary items. 3.3 Use the following information for Zohrain Corporation given at the end of 2019. Current Assets Current Liabilities Fixed Assets, Net- Investments Long-Term Debt-...
-
A friend invites you to participate in a monthly "tanda" that will give you $35,000, she tells you that you will be paid an interest of 30% per year, you accept and take your turn, it's turn 19. How...
-
Specifyforeach ofthefollowingtransactionswhetheritis assessable income, exempt income, or non-assessable non-exempt income. ( a )Janicereceivedgross wages of $74,000 fromherhusband thenfor...
-
Microsoft Corporation Many industries have specific reporting standards that are necessary to present an entity's financial position. For example, insurance companies must follow the accounting and...
-
Ester Limited produces two products X and Y by producing a common raw material in a common production process. The production for the month of April was 8000 units of X and 6000 units of Y. Whereas...
-
Write each fraction as a percent. 7 50
-
Annuities are streams of payments that the owner of an annuity receives for some specified period of time. The holder of an annuity can sell it to someone else who then becomes the recipient of the...
-
The Software Industry: When personal computers first came onto the scene, the task of writing software was considerably more difficult than it is today. Over the following decades, consumer demand...
-
Business Application: Valuing Land in Equilibrium: Suppose we consider a Robinson Crusoe economy with one worker who has preferences over leisure and consumption and one firm that uses a constant...
-
In Appendix 16A.1, we illustrate the calculation of a standard error for the marginal effect in a probit model of transportation, Example 16.4. In the appendix, the calculation is for the marginal...
-
In Examples 16.2 and 16.4, we presented the linear probability and probit model estimates using an example of transportation choice. The logit model for the same example is \(P(A U T...
-
In Example 16.3, we illustrate the calculation of the likelihood function for the probit model in a small example. a. Calculate the probability that \(y=1\) if \(x=1.5\), given the values of the...
Study smarter with the SolutionInn App