選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

blink8-drcn.c 1.7 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * blink8-drcn.c:
  3. * Simple sequence over the first 8 GPIO pins - LEDs
  4. * Aimed at the Ladder board, but it's fairly generic.
  5. *
  6. * Copyright (c) 2012-2013 Gordon Henderson.
  7. ***********************************************************************
  8. * This file is part of wiringPi:
  9. * https://github.com/WiringPi/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. #include <drcNet.h>
  28. int main (void)
  29. {
  30. int i, led ;
  31. printf ("Raspberry Pi - 8-LED Sequencer\n") ;
  32. printf ("==============================\n") ;
  33. printf ("\n") ;
  34. printf ("Connect LEDs to the first 8 GPIO pins and watch ...\n") ;
  35. int pinBase = 100 ;
  36. // wiringPiSetup () ;
  37. drcSetupNet (pinBase, 100, "192.168.254.21", "6124", "123456") ;
  38. for (i = 0 ; i < 8 ; ++i)
  39. pinMode (i + pinBase, OUTPUT) ;
  40. for (;;)
  41. {
  42. for (led = 0 ; led < 8 ; ++led)
  43. {
  44. digitalWrite (led + pinBase, 1) ;
  45. delay (10) ;
  46. }
  47. for (led = 0 ; led < 8 ; ++led)
  48. {
  49. digitalWrite (led + pinBase, 0) ;
  50. delay (10) ;
  51. }
  52. }
  53. }