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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * piglow.c:
  3. * Very simple demonstration of the PiGlow board.
  4. * This uses the SN3218 directly - soon there will be a new PiGlow
  5. * devLib device which will handle the PiGlow board on a more easy
  6. * to use manner...
  7. *
  8. * Copyright (c) 2013 Gordon Henderson.
  9. ***********************************************************************
  10. * This file is part of wiringPi:
  11. * https://github.com/WiringPi/WiringPi/
  12. *
  13. * wiringPi is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Lesser General Public License as published by
  15. * the Free Software Foundation, either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * wiringPi is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Lesser General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Lesser General Public License
  24. * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  25. ***********************************************************************
  26. */
  27. #include <wiringPi.h>
  28. #include <sn3218.h>
  29. #define LED_BASE 533
  30. int main (void)
  31. {
  32. int i, j ;
  33. wiringPiSetupSys () ;
  34. sn3218Setup (LED_BASE) ;
  35. for (;;)
  36. {
  37. for (i = 0 ; i < 256 ; ++i)
  38. for (j = 0 ; j < 18 ; ++j)
  39. analogWrite (LED_BASE + j, i) ;
  40. for (i = 255 ; i >= 0 ; --i)
  41. for (j = 0 ; j < 18 ; ++j)
  42. analogWrite (LED_BASE + j, i) ;
  43. }
  44. }