Advertisement
Guest User

Untitled

a guest
Mar 21st, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /*
  2. * stress.c:
  3. * WiringPi stress test (in progress by chod, origonal good stuff as below.
  4. *
  5. * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
  6. ***********************************************************************
  7. */
  8.  
  9. #include <stdio.h>
  10. #include <wiringPi.h>
  11. #include <mcp23s17.h>
  12.  
  13. #define BASE_SPI 100
  14. #define BASE_SPI2 116
  15. int main (void)
  16. {
  17. int bit ;
  18. int i;
  19.  
  20. wiringPiSetup () ;
  21. mcp23s17Setup (BASE_SPI, 0, 1) ;
  22. mcp23s17Setup (BASE_SPI2, 0, 0) ;
  23.  
  24. printf ("Raspberry Pi - MCP23S17 X2 Test\n") ;
  25.  
  26. for(i = 0; i < 16; ++i){
  27. pinMode (BASE_SPI + i, OUTPUT) ;
  28. pinMode (BASE_SPI2+i, OUTPUT) ;
  29. }
  30.  
  31. for (;;)
  32. {
  33.  
  34. for (bit = 0 ; bit < 16 ; ++bit)
  35. {
  36. printf("%d\n",BASE_SPI + bit);
  37. digitalWrite (BASE_SPI + bit, 1) ;
  38. delay (200) ;
  39. digitalWrite (BASE_SPI + bit, 0) ;
  40. delay (200) ;
  41. }
  42.  
  43. }
  44.  
  45. return 0 ;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement