Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the above code to do this problem (below): void setup() { pinMode(13, OUTPUT); Serial.begin(9600); while (!Serial); Serial.println(Input 1 to Turn LED on and 2

image text in transcribedModify the above code to do this problem (below):

image text in transcribed

void setup() \{ pinMode(13, OUTPUT); Serial.begin(9600); while (!Serial); Serial.println("Input 1 to Turn LED on and 2 to off"); \} void loop ()\{ if (Serial.available()) \{ int state = Serial.parselnt () ; if ( state ==1) \{ digitalWrite(13, HIGH); Serial.println("Command completed LED turned ON"); \} if ( state ==2) \{ digitalWrite(13, LOW); Serial.println("Command completed LED turned OFF"); \} When you press 1 , the green LED should be turned on When you press 2 , the green LED should be turned off When you press 3 , the yellow LED should be turned on When you press 4 , the yellow LED should be turned off When you press 5 , the red LED should be turned on When you press 6 , the red LED should be turned off

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: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago