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

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Identify the types of informal reports.

Answered: 1 week ago

Question

Write messages that are used for the various stages of collection.

Answered: 1 week ago