Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Exercises 5: First Exercise on Hardware: LEDsGoal: | ||||||||
Line: 28 to 28 | ||||||||
In order to translate your blinking program into C you will have to include <wiringPi.h>. Then you can call wiringPiSetup () to initialize the library. Finally use pinMode and digitalWrite to tel the library you want to use the pin as output pin and write to it. Check the wiringpi API documentation for the parameters of these calls. When building the program you have to link the wiringPi library to your program (-lwiringPi). The wiringpi include files and the library are stored in /usr/local/include and /usr/local/lib respectively. Write a Makefile to build your project. Test it to make sure it works as expected. | ||||||||
Changed: | ||||||||
< < | Exercise 5: Make your LED blink SOS | |||||||
> > | Exercise 5: Implementing your own gpio command | |||||||
Changed: | ||||||||
< < | Write a C program that makes the LED blink an SOS. Write a subroutine pulse (int pulseLength) that switches the LED on for pulsLength ms and then off again for pulseLength ms. Use this routine to implement the SOS. Wait for 1 s between each SOS sequence. | |||||||
> > | Knowing how to switch on and off the LED and knowing that you can read and write a gpio pin, can you write your own mygpio command? This command will take 2 or 3 command line parameters:
Exercise 6: Make your LED blink SOSWrite a C program that makes the LED blink an SOS. Write a subroutine pulse (int pulseLength) that switches the LED on for pulseLength ms and then off again for pulseLength ms. Use this routine to implement the SOS. Wait for 1 s between each SOS sequence. | |||||||
-- Uli Raich - 2017-01-03 |