3 * Simple test program to test the wiringPi functions
4 * This is a sequencer to make a patter appear on 8 LEDs
5 * connected to the GPIO pins.
7 * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
8 ***********************************************************************
9 * This file is part of wiringPi:
10 * https://projects.drogon.net/raspberry-pi/wiringpi/
12 * wiringPi is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * wiringPi is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
24 ***********************************************************************
34 // Simple sequencer data
35 // Triplets of LED, On/Off and delay
50 0, 0, 1, // Extra delay
65 0, 0, 1, // Extra delay
67 9, 9, 9, // End marker
78 printf ("Raspberry Pi wiringPi test program\n") ;
80 if (wiringPiSetup () == -1)
83 for (pin = 0 ; pin < 8 ; ++pin)
84 pinMode (pin, OUTPUT) ;
86 pinMode (8, INPUT) ; // Pin 8 SDA0 - Has on-board 2k2 pull-up resistor
92 l = data [dataPtr++] ; // LED
93 s = data [dataPtr++] ; // State
94 d = data [dataPtr++] ; // Duration (10ths)
96 if ((l + s + d) == 27)
102 digitalWrite (l, s) ;
104 if (digitalRead (8) == 0) // Pressed as our switch shorts to ground
105 delay (d * 10) ; // Faster!