You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blink8.c 1.6 KiB

12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
12 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * blink8.c:
  3. * Simple sequence over the first 8 GPIO pins - LEDs
  4. * Aimed at the Gertboard, but it's fairly generic.
  5. *
  6. * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
  7. ***********************************************************************
  8. * This file is part of wiringPi:
  9. * https://projects.drogon.net/raspberry-pi/wiringpi/
  10. *
  11. * wiringPi is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Lesser General Public License as published by
  13. * the Free Software Foundation, either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * wiringPi is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public License
  22. * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  23. ***********************************************************************
  24. */
  25. #include <stdio.h>
  26. #include <wiringPi.h>
  27. int main (void)
  28. {
  29. int i, led ;
  30. printf ("Raspberry Pi - 8-LED Sequencer\n") ;
  31. printf ("==============================\n") ;
  32. printf ("\n") ;
  33. printf ("Connect LEDs to the first 8 GPIO pins and watch ...\n") ;
  34. wiringPiSetup () ;
  35. for (i = 0 ; i < 8 ; ++i)
  36. pinMode (i, OUTPUT) ;
  37. for (;;)
  38. {
  39. for (led = 0 ; led < 8 ; ++led)
  40. {
  41. digitalWrite (led, 1) ;
  42. delay (100) ;
  43. }
  44. for (led = 0 ; led < 8 ; ++led)
  45. {
  46. digitalWrite (led, 0) ;
  47. delay (100) ;
  48. }
  49. }
  50. }