Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Figure 3a shows the Arduino board that integrated with 6 LEDs and 1 switch, while Figure 3b shows the executed C program which is simulated

image text in transcribed
image text in transcribed
image text in transcribed
Figure 3a shows the Arduino board that integrated with 6 LEDs and 1 switch, while Figure 3b shows the executed C program which is simulated using Tinkercad. LED 4 LED 5 LED 6 LED 3 LED 2 LED 1 IR OO UNO ARDUINO POWER ANAGER 1 int buttonState = 0; 2 void setup() 3 4 pinMode(2, INPUT); 5 pinMode(13, OUTPUT); 6 pinMode(11, OUTPUT); pinMode (9, OUTPUT); 8 pinMode(7, OUTPUT); SEGMENT 1 9 pinMode(S, OUTPUT); 10 pinMode(3, OUTPUT); 11 digitalWrite(11, HIGH); 22 digitalWrite (7, HIGH); 13 ) 14 15 void loop() 26 17 11 read the input pin 18 buttonstate - digitalRead(2); 29 delay(10); // Delay a little bit to improve 20 1/ simulation performance 21 if (buttonstate - HIGH) 21 24 digitalWrite(9, HIGH); 25 digitalWrite(3, LOW); 26 } 27 else 28 C 29 digitalWrite(9, LOW); 30 digitalWrite(3, HIGH); digitalWrite(13, HIGH); delay(1000); 34 digitalWrite(13,LOW); 35 delay(1000); 22 Figure 3D a. From the given code in Figure 3b, Segment I shows how the desired pins are set. Justify the reason why pin no. 2 is set as "INPUT" while the rest (pin no. 3, 5, 7, 9, 11 and 13) are set as "OUTPUT". [3 marks b. Complete the following table that shows the status of each LED after the program was executed: [6 marks) i. While the switch IS NOT PRESSED LED no. Status (Turn ON, Turn OFF or Blinking) 1 2 3 4 5 6 ii. While the switch IS PRESSED (continuously hold the press) LED no Status (Turn ON, Turn OFF or Blinking) 1 2 3 4 S 6 c. Based on the same Arduino circuit, write a C program (without the switch) that produce the following output?: 111 marks LED no. Status (Forever) 1 Blinking 2 Turn OFF 3 Turn ON 4 5 5 Blinking Blinking Turn ON 6

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago

Question

=+Is it possible to operate union-free?

Answered: 1 week ago

Question

=+impact member states and MNEs?

Answered: 1 week ago