Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C programming write a program to turn ona LEDusing araspberry pi by writing HIGH to that GPIO pin, display a message stating it is

Using C programming write a program to turn ona LEDusing araspberry pi by writing HIGH to that GPIO pin, display a message stating it is currently on, and wait for the user to press the Enter key, then turn off the LED by writing LOW to the chosen pin. Your output should look like this: The LED is currently ON - Press key to turn off - The LED is currently OFF In order to access the GPIO pins, your program must include the WiringPi library header: wiringPi.h. Also, your program must setup the pin modes by including the following statements (in the main function): wiringPiSetup(); pinMode(, );. Note that is the WiringPi pin number that corresponds to the Raspberry Pi GPIO Header pin number.If you want to set a pin as either an output or input pin, then must be set to either OUTPUT or INPUT. For example, to set pin 0 (header pin 11) as output, you would right: pinMode(0,OUTPUT);. When a pin mode is set to output, you can change its state by writing the following: digitalWrite(,) where is either HIGH or LOW. If set to HIGH, the pins voltage will be set at 3.3v. If set to LOW, its voltage should be close to 0v. Note that to use getchar() you should include the string.h library header.

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions