Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 (40 points) Write a C program to do the following: - . A green LED is blinking (on 1 second, off 1 second)

image text in transcribed
Question 2 (40 points) Write a C program to do the following: - . A green LED is blinking (on 1 second, off 1 second) Every time a magnet is detected, the blinking becomes slower (on 2 seconds off 2 seconds) and a red LED turns on and stays on as long as the magnet is close Once the magnet is removed, only the green LED blinks again (on 1 second, off 1 second) . Use GPIO2 for green LED, GPIO3 for red LED, and GPIO4 for the Reed Switch. Show the connections from the elements to Raspberry Pi in the picture below. Make sure you include the necessary ground (GND) and Vec (3.3V) connections. use of the Counter?? # Include Volatile int counter.o # Include counter t int main C) what is Riotorte wiring Pisetup(); Pin Mode (2, OUTPUT); Il green Pin Mode (3, OUTPUT); // red Pin Mode (4, INPUT); Il Reed switch output for (;;) E (digital Read (4) == 1) if (Digital feadfoot) & digital Write 13, Low), digital Write (2, HIGH); delay (1000); digital Write ( 2, Low); z delay (1000); else e digital Write (3, HIGH); delay (2000); digital Write (3, how); Question 2 (40 points) Write a C program to do the following: - . A green LED is blinking (on 1 second, off 1 second) Every time a magnet is detected, the blinking becomes slower (on 2 seconds off 2 seconds) and a red LED turns on and stays on as long as the magnet is close Once the magnet is removed, only the green LED blinks again (on 1 second, off 1 second) . Use GPIO2 for green LED, GPIO3 for red LED, and GPIO4 for the Reed Switch. Show the connections from the elements to Raspberry Pi in the picture below. Make sure you include the necessary ground (GND) and Vec (3.3V) connections. use of the Counter?? # Include Volatile int counter.o # Include counter t int main C) what is Riotorte wiring Pisetup(); Pin Mode (2, OUTPUT); Il green Pin Mode (3, OUTPUT); // red Pin Mode (4, INPUT); Il Reed switch output for (;;) E (digital Read (4) == 1) if (Digital feadfoot) & digital Write 13, Low), digital Write (2, HIGH); delay (1000); digital Write ( 2, Low); z delay (1000); else e digital Write (3, HIGH); delay (2000); digital Write (3, how)

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

Students also viewed these Databases questions