3 * Easy access to the Pimoroni PiGlow board.
5 * Copyright (c) 2013 Gordon Henderson.
6 ***********************************************************************
7 * This file is part of wiringPi:
8 * https://projects.drogon.net/raspberry-pi/wiringpi/
10 * wiringPi is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * wiringPi is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
22 ***********************************************************************
32 static int leg0 [6] = { 6, 7, 8, 5, 4, 9 } ;
33 static int leg1 [6] = { 17, 16, 15, 13, 11, 10 } ;
34 static int leg2 [6] = { 0, 1, 2, 3, 14, 12 } ;
39 * Light up an individual LED
40 *********************************************************************************
43 void piGlow1 (const int leg, const int ring, const int intensity)
47 if ((leg < 0) || (leg > 2)) return ;
48 if ((ring < 0) || (ring > 5)) return ;
57 analogWrite (myBase + legLeds [ring], intensity) ;
62 * Light up all 6 LEDs on a leg
63 *********************************************************************************
66 void piGlowLeg (const int leg, const int intensity)
71 if ((leg < 0) || (leg > 2))
81 for (i = 0 ; i < 6 ; ++i)
82 analogWrite (myBase + legLeds [i], intensity) ;
88 * Light up 3 LEDs in a ring. Ring 0 is the outermost, 5 the innermost
89 *********************************************************************************
92 void piGlowRing (const int ring, const int intensity)
94 if ((ring < 0) || (ring > 5))
97 analogWrite (myBase + leg0 [ring], intensity) ;
98 analogWrite (myBase + leg1 [ring], intensity) ;
99 analogWrite (myBase + leg2 [ring], intensity) ;
104 * Initialise the board & remember the pins we're using
105 *********************************************************************************
108 void piGlowSetup (const int pinBase)
110 sn3218Setup (myBase = pinBase) ;
112 // Turn all off to start with