Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * stress.c:
- *Â Â Â Â Â WiringPi stress test
- *
- * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
- ***********************************************************************
- */
- #include <stdio.h>
- #include <wiringPi.h>
- #include <mcp23s17.h>
- // #include <mcp23017.h>
- // #include <sr595.h>
- // The first pin number for each device
- #define BASE_SPI 123
- // #define BASE_I2C 456
- // #define BASE_SR 789
- int main (void)
- {
- int i, bit ;
- wiringPiSetup () ;
- //mcp23017Setup (BASE_I2C, 0x20) ;
- mcp23s17Setup (BASE_SPI, 0, 0) ;
- //sr595Setup (BASE_SR, 10, 0, BASE_SPI, BASE_I2C) ;
- printf ("Raspberry Pi - MCP23S17 Test\n") ;
- // For the push button to stop it...
- pinMode (BASE_SPI + 15, INPUT) ;
- pullUpDnControl (BASE_SPI + 15, PUD_UP) ;
- for (;;)
- {
- for (i = 0 ; i < 1024 ; ++i)
- {
- for (bit = 0 ; bit < 10 ; ++bit)
- digitalWrite (BASE_SPI + bit, i & (1 << bit)) ;
- delay (5) ;
- while (digitalRead (BASE_SPI + 15) == 0)
- delay (1) ;
- }
- }
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement