Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need an arduino code 6) Create 3 functions which match the following types A) Simple if /else decision statement //Reference> Language> Structure> Control structure

i need an arduino code
image text in transcribed
6) Create 3 functions which match the following types A) Simple "if /else" decision statement //Reference> Language> Structure> Control structure (Compare value, of the ANALOG pin to some 'int' value "threshold") This function should set the DIGITAL (output) pin to either HIGH or LOW based on the value of your ANALOG input. (Attaching an LED to that pin will allow you to see the current state of the decision criteria) (ex. Set the int value [threshold] to '1000 Analog input is 3.3v-value read in is 1023 which is> 1000 so the value is True) Also: Set (change the value of) the GLOBAL BOOLEAN variable you made in step 1 to TRUE) in the case of a value above the threshold, and (FALSE) in all other cases (else) B) A switch/ case statement//Reference >Language >Structure> Control structure 1) Using one BIT from the DIGITAL (input) pin, and the Boolean you set from the ANALOG pin in function A, create a switch structure with 4 conditional cases: Digital State Boolean State 0 0 0 0 2) Each case should set should set (assign the value of TWO DIGITAL pins HIGH or LOW based on the values of the DIGITAL pin (5) and the bool in function (A) based on the value threshold You should print a unique string to the host computer via the SERIAL console to indicate the case selected by each binary state. C) Build a function that TAKES as an argument, the current ANALOG value and RETURNS the result of TWO sequential [the result of one operation is the input of the second] arithmetic operations. Use the constant student id you declared in (2) as an input to at least one of your operations. You may use the MATH built in functions, but they must be called inside your user defined function. /Reference >Language>Functions>Math

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

More Books

Students also viewed these Databases questions

Question

What is meant by the terms brain drain and reverse brain drain?

Answered: 1 week ago

Question

The Nature of Nonverbal Communication

Answered: 1 week ago

Question

Functions of Nonverbal Communication

Answered: 1 week ago

Question

Nonverbal Communication Codes

Answered: 1 week ago