initial cleanup and mapping

This commit is contained in:
unknown
2016-08-18 21:52:18 +03:00
parent 1d89a05234
commit faf062af8b
155 changed files with 23233 additions and 0 deletions

85
examples/PiFace/Makefile Normal file
View File

@ -0,0 +1,85 @@
#
# Makefile:
# wiringPi - Wiring Compatable library for the Raspberry Pi
# https://projects.drogon.net/wiring-pi
#
# Copyright (c) 2012 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# Wiring Compatable library for the Raspberry Pi
#
# wiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################
#DEBUG = -g -O0
DEBUG = -O3
CC = gcc
INCLUDE = -I/usr/local/include
CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
LDFLAGS = -L/usr/local/lib
LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm
# Should not alter anything below this line
###############################################################################
SRC = blink.c buttons.c reaction.c ladder.c metro.c motor.c
OBJ = $(SRC:.c=.o)
BINS = $(SRC:.c=)
all: $(BINS)
blink: blink.o
@echo [link]
@$(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS)
buttons: buttons.o
@echo [link]
@$(CC) -o $@ buttons.o $(LDFLAGS) $(LDLIBS)
reaction: reaction.o
@echo [link]
@$(CC) -o $@ reaction.o $(LDFLAGS) $(LDLIBS)
ladder: ladder.o
@echo [link]
@$(CC) -o $@ ladder.o $(LDFLAGS) $(LDLIBS)
metro: metro.o
@echo [link]
@$(CC) -o $@ metro.o $(LDFLAGS) $(LDLIBS)
motor: motor.o
@echo [link]
@$(CC) -o $@ motor.o $(LDFLAGS) $(LDLIBS)
.c.o:
@echo [CC] $<
@$(CC) -c $(CFLAGS) $< -o $@
clean:
@echo "[Clean]"
@rm -f $(OBJ) *~ core tags $(BINS)
tags: $(SRC)
@echo [ctags]
@ctags $(SRC)
depend:
makedepend -Y $(SRC)
# DO NOT DELETE

59
examples/PiFace/blink.c Normal file
View File

@ -0,0 +1,59 @@
/*
* blink.c:
* Simple "blink" test for the PiFace interface board.
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <wiringPi.h>
#include <piFace.h>
// Use 200 as the pin-base for the PiFace board, and pick a pin
// for the LED that's not connected to a relay
#define PIFACE 200
#define LED (PIFACE+2)
int main (int argc, char *argv [])
{
printf ("Raspberry Pi PiFace Blink\n") ;
printf ("=========================\n") ;
// Always initialise wiringPi. Use wiringPiSys() if you don't need
// (or want) to run as root
wiringPiSetupSys () ;
// Setup the PiFace board
piFaceSetup (PIFACE) ;
for (;;)
{
digitalWrite (LED, HIGH) ; // On
delay (500) ; // mS
digitalWrite (LED, LOW) ; // Off
delay (500) ;
}
return 0 ;
}

103
examples/PiFace/buttons.c Normal file
View File

@ -0,0 +1,103 @@
/*
* buttons.c:
* Simple test for the PiFace interface board.
*
* Read the buttons and output the same to the LEDs
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <wiringPi.h>
#include <piFace.h>
int outputs [4] = { 0,0,0,0 } ;
// Use 200 as the pin-base for the PiFace board
#define PIFACE_BASE 200
/*
* scanButton:
* Read the guiven button - if it's pressed, then flip the state
* of the correspoinding output pin
*********************************************************************************
*/
void scanButton (int button)
{
if (digitalRead (PIFACE_BASE + button) == LOW)
{
outputs [button] ^= 1 ;
digitalWrite (PIFACE_BASE + button, outputs [button]) ;
printf ("Button %d pushed - output now: %s\n",
button, (outputs [button] == 0) ? "Off" : "On") ;
}
while (digitalRead (PIFACE_BASE + button) == LOW)
delay (1) ;
}
/*
* start here
*********************************************************************************
*/
int main (void)
{
int pin, button ;
printf ("Raspberry Pi wiringPi + PiFace test program\n") ;
printf ("===========================================\n") ;
printf ("\n") ;
printf (
"This program reads the buttons and uses them to toggle the first 4\n"
"outputs. Push a button once to turn an output on, and push it again to\n"
"turn it off again.\n\n") ;
// Always initialise wiringPi. Use wiringPiSys() if you don't need
// (or want) to run as root
wiringPiSetupSys () ;
piFaceSetup (PIFACE_BASE) ;
// Enable internal pull-ups & start with all off
for (pin = 0 ; pin < 8 ; ++pin)
{
pullUpDnControl (PIFACE_BASE + pin, PUD_UP) ;
digitalWrite (PIFACE_BASE + pin, 0) ;
}
// Loop, scanning the buttons
for (;;)
{
for (button = 0 ; button < 4 ; ++button)
scanButton (button) ;
delay (5) ;
}
return 0 ;
}

337
examples/PiFace/ladder.c Normal file
View File

@ -0,0 +1,337 @@
/*
* ladder.c:
*
* Gordon Henderson, June 2012
***********************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <wiringPi.h>
#include <piFace.h>
#ifndef TRUE
# define TRUE (1==1)
# define FALSE (1==2)
#endif
#undef DEBUG
#define NUM_LEDS 8
// Map the LEDs to the hardware pins
// using PiFace pin numbers here
#define PIFACE 200
const int ledMap [NUM_LEDS] =
{
// 0, 1, 2, 3, 4, 5, 6, 7, 8
200, 201, 202, 203, 204, 205, 206, 207
} ;
// Some constants for our circuit simulation
const double vBatt = 9.0 ; // Volts (ie. a PP3)
const double capacitor = 0.001 ; // 1000uF
const double rCharge = 2200.0 ; // ohms
const double rDischarge = 68000.0 ; // ohms
const double timeInc = 0.01 ; // Seconds
double vCharge, vCap, vCapLast ;
/*
* setup:
* Program the GPIO correctly and initialise the lamps
***********************************************************************
*/
void setup (void)
{
int i ;
wiringPiSetupSys () ;
if (piFaceSetup (200) == -1)
exit (1) ;
// Enable internal pull-ups
for (i = 0 ; i < 8 ; ++i)
pullUpDnControl (PIFACE + i, PUD_UP) ;
// Calculate the actual charging voltage - standard calculation of
// vCharge = r2 / (r1 + r2) * vBatt
//
//
// -----+--- vBatt
// |
// R1
// |
// +---+---- vCharge
// | |
// R2 C
// | |
// -----+---+-----
vCharge = rDischarge / (rCharge + rDischarge) * vBatt ;
// Start with no charge
vCap = vCapLast = 0.0 ;
}
/*
* introLeds
* Put a little pattern on the LEDs to start with
*********************************************************************************
*/
void introLeds (void)
{
int i, j ;
printf ("Pi Ladder\n") ;
printf ("=========\n\n") ;
printf (" vBatt: %6.2f volts\n", vBatt) ;
printf (" rCharge: %6.0f ohms\n", rCharge) ;
printf (" rDischarge: %6.0f ohms\n", rDischarge) ;
printf (" vCharge: %6.2f volts\n", vCharge) ;
printf (" capacitor: %6.0f uF\n", capacitor * 1000.0) ;
// Flash 3 times:
for (j = 0 ; j < 3 ; ++j)
{
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 1) ;
delay (500) ;
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 0) ;
delay (100) ;
}
// All On
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 1) ;
delay (500) ;
// Countdown...
for (i = NUM_LEDS - 1 ; i >= 0 ; --i)
{
digitalWrite (ledMap [i], 0) ;
delay (100) ;
}
delay (500) ;
}
/*
* winningLeds
* Put a little pattern on the LEDs to start with
*********************************************************************************
*/
void winningLeds (void)
{
int i, j ;
// Flash 3 times:
for (j = 0 ; j < 3 ; ++j)
{
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 1) ;
delay (500) ;
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 0) ;
delay (100) ;
}
// All On
for (i = 0 ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 1) ;
delay (500) ;
// Countup...
for (i = 0 ; i < NUM_LEDS ; ++i)
{
digitalWrite (ledMap [i], 0) ;
delay (100) ;
}
delay (500) ;
}
/*
* chargeCapacitor: dischargeCapacitor:
* Add or remove charge to the capacitor.
* Standard capacitor formulae.
*********************************************************************************
*/
void chargeCapacitor (void)
{
vCap = (vCapLast - vCharge) *
exp (- timeInc / (rCharge * capacitor)) + vCharge ;
#ifdef DEBUG
printf ("+vCap: %7.4f\n", vCap) ;
#endif
vCapLast = vCap ;
}
void dischargeCapacitor (void)
{
vCap = vCapLast *
exp (- timeInc / (rDischarge * capacitor)) ;
#ifdef DEBUG
printf ("-vCap: %7.4f\n", vCap) ;
#endif
vCapLast = vCap ;
}
/*
* ledBargraph:
* Output the supplied number as a bargraph on the LEDs
*********************************************************************************
*/
void ledBargraph (double value, int topLedOn)
{
int topLed = (int)floor (value / vCharge * (double)NUM_LEDS) + 1 ;
int i ;
if (topLed > NUM_LEDS)
topLed = NUM_LEDS ;
if (!topLedOn)
--topLed ;
for (i = 0 ; i < topLed ; ++i)
digitalWrite (ledMap [i], 1) ;
for (i = topLed ; i < NUM_LEDS ; ++i)
digitalWrite (ledMap [i], 0) ;
}
/*
* ledOnAction:
* Make sure the leading LED is on and check the button
*********************************************************************************
*/
void ledOnAction (void)
{
if (digitalRead (PIFACE) == LOW)
{
chargeCapacitor () ;
ledBargraph (vCap, TRUE) ;
}
}
/*
* ledOffAction:
* Make sure the leading LED is off and check the button
*********************************************************************************
*/
void ledOffAction (void)
{
dischargeCapacitor () ;
// Are we still pushing the button?
if (digitalRead (PIFACE) == LOW)
{
vCap = vCapLast = 0.0 ;
ledBargraph (vCap, FALSE) ;
// Wait until we release the button
while (digitalRead (PIFACE) == LOW)
delay (10) ;
}
}
/*
***********************************************************************
* The main program
***********************************************************************
*/
int main (void)
{
unsigned int then, ledOnTime, ledOffTime ;
unsigned int ourDelay = (int)(1000.0 * timeInc) ;
setup () ;
introLeds () ;
// Setup the LED times - TODO reduce the ON time as the game progresses
ledOnTime = 1000 ;
ledOffTime = 1000 ;
// This is our Gate/Squarewave loop
for (;;)
{
// LED ON:
(void)ledBargraph (vCap, TRUE) ;
then = millis () + ledOnTime ;
while (millis () < then)
{
ledOnAction () ;
delay (ourDelay) ;
}
// Have we won yet?
// We need vCap to be in the top NUM_LEDS of the vCharge
if (vCap > ((double)(NUM_LEDS - 1) / (double)NUM_LEDS * vCharge)) // Woo hoo!
{
winningLeds () ;
while (digitalRead (PIFACE) == HIGH)
delay (10) ;
while (digitalRead (PIFACE) == LOW)
delay (10) ;
vCap = vCapLast = 0.0 ;
}
// LED OFF:
(void)ledBargraph (vCap, FALSE) ;
then = millis () + ledOffTime ;
while (millis () < then)
{
ledOffAction () ;
delay (ourDelay) ;
}
}
return 0 ;
}

111
examples/PiFace/metro.c Normal file
View File

@ -0,0 +1,111 @@
/*
* metronome.c:
* Simple test for the PiFace interface board.
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wiringPi.h>
#include <piFace.h>
#define PIFACE 200
/*
* middleA:
* Play middle A (on the relays - yea!)
*********************************************************************************
*/
static void middleA (void)
{
unsigned int next ;
for (;;)
{
next = micros () + 1136 ;
digitalWrite (PIFACE + 0, 0) ;
digitalWrite (PIFACE + 1, 0) ;
while (micros () < next)
delayMicroseconds (1) ;
next = micros () + 1137 ;
digitalWrite (PIFACE + 0, 1) ;
digitalWrite (PIFACE + 1, 1) ;
while (micros () < next)
delayMicroseconds (1) ;
}
}
int main (int argc, char *argv [])
{
int bpm, msPerBeat, state = 0 ;
unsigned int end ;
printf ("Raspberry Pi PiFace Metronome\n") ;
printf ("=============================\n") ;
piHiPri (50) ;
wiringPiSetupSys () ; // Needed for timing functions
piFaceSetup (PIFACE) ;
if (argc != 2)
{
printf ("Usage: %s <beates per minute>\n", argv [0]) ;
exit (1) ;
}
if (strcmp (argv [1], "a") == 0)
middleA () ;
bpm = atoi (argv [1]) ;
if ((bpm < 40) || (bpm > 208))
{
printf ("%s range is 40 through 208 beats per minute\n", argv [0]) ;
exit (1) ;
}
msPerBeat = 60000 / bpm ;
// Main loop:
// Put some random LED pairs up for a few seconds, then blank ...
for (;;)
{
end = millis () + msPerBeat ;
digitalWrite (PIFACE + 0, state) ;
digitalWrite (PIFACE + 1, state) ;
while (millis () < end)
delayMicroseconds (500) ;
state ^= 1 ;
}
return 0 ;
}

120
examples/PiFace/motor.c Normal file
View File

@ -0,0 +1,120 @@
/*
* motor.c:
* Use the PiFace board to demonstrate an H bridge
* circuit via the 2 relays.
* Then add on an external transsitor to help with PWM.
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <wiringPi.h>
#include <piFace.h>
#include <softPwm.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int outputs [2] = { 0,0 } ;
#define PIFACE_BASE 200
#define PWM_OUT_PIN 204
#define PWM_UP 202
#define PWM_DOWN 203
void scanButton (int button)
{
if (digitalRead (PIFACE_BASE + button) == LOW)
{
outputs [button] ^= 1 ;
digitalWrite (PIFACE_BASE + button, outputs [button]) ;
printf ("Button %d pushed - output now: %s\n",
button, (outputs [button] == 0) ? "Off" : "On") ;
}
while (digitalRead (PIFACE_BASE + button) == LOW)
delay (1) ;
}
int main (void)
{
int pin, button ;
int pwmValue = 0 ;
printf ("Raspberry Pi PiFace - Motor control\n") ;
printf ("==================================\n") ;
printf ("\n") ;
printf (
"This program is designed to be used with a motor connected to the relays\n"
"in an H-Bridge type configuration with optional speeed control via PWM.\n"
"\n"
"Use the leftmost buttons to turn each relay on and off, and the rigthmost\n"
"buttons to increase ot decrease the PWM output on the control pin (pin\n"
"4)\n\n") ;
wiringPiSetup () ;
piFaceSetup (PIFACE_BASE) ;
softPwmCreate (PWM_OUT_PIN, 100, 100) ;
// Enable internal pull-ups & start with all off
for (pin = 0 ; pin < 8 ; ++pin)
{
pullUpDnControl (PIFACE_BASE + pin, PUD_UP) ;
digitalWrite (PIFACE_BASE + pin, 0) ;
}
for (;;)
{
for (button = 0 ; button < 2 ; ++button)
scanButton (button) ;
if (digitalRead (PWM_UP) == LOW)
{
pwmValue += 10 ;
if (pwmValue > 100)
pwmValue = 100 ;
softPwmWrite (PWM_OUT_PIN, pwmValue) ;
printf ("PWM -> %3d\n", pwmValue) ;
while (digitalRead (PWM_UP) == LOW)
delay (5) ;
}
if (digitalRead (PWM_DOWN) == LOW)
{
pwmValue -= 10 ;
if (pwmValue < 0)
pwmValue = 0 ;
softPwmWrite (PWM_OUT_PIN, pwmValue) ;
printf ("PWM -> %3d\n", pwmValue) ;
while (digitalRead (PWM_DOWN) == LOW)
delay (5) ;
}
delay (5) ;
}
return 0 ;
}

194
examples/PiFace/reaction.c Normal file
View File

@ -0,0 +1,194 @@
/*
* reaction.c:
* Simple test for the PiFace interface board.
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <wiringPi.h>
#include <piFace.h>
int outputs [4] = { 0,0,0,0 } ;
#define PIFACE 200
/*
* light:
* Light up the given LED - actually lights up a pair
*********************************************************************************
*/
void light (int led, int value)
{
led *= 2 ;
digitalWrite (PIFACE + led + 0, value) ;
digitalWrite (PIFACE + led + 1, value) ;
}
/*
* lightAll:
* All On or Off
*********************************************************************************
*/
void lightAll (int onoff)
{
light (0, onoff) ;
light (1, onoff) ;
light (2, onoff) ;
light (3, onoff) ;
}
/*
* waitForNoButtons:
* Wait for all buttons to be released
*********************************************************************************
*/
void waitForNoButtons (void)
{
int i, button ;
for (;;)
{
button = 0 ;
for (i = 0 ; i < 4 ; ++i)
button += digitalRead (PIFACE + i) ;
if (button == 4)
break ;
}
}
void scanButton (int button)
{
if (digitalRead (PIFACE + button) == LOW)
{
outputs [button] ^= 1 ;
digitalWrite (PIFACE + button, outputs [button]) ;
}
while (digitalRead (PIFACE + button) == LOW)
delay (1) ;
}
int main (void)
{
int i, j ;
int led, button ;
unsigned int start, stop ;
printf ("Raspberry Pi PiFace Reaction Timer\n") ;
printf ("==================================\n") ;
if (piFaceSetup (PIFACE) == -1)
exit (1) ;
// Enable internal pull-ups
for (i = 0 ; i < 8 ; ++i)
pullUpDnControl (PIFACE + i, PUD_UP) ;
// Main game loop:
// Put some random LED pairs up for a few seconds, then blank ...
for (;;)
{
printf ("Press any button to start ... \n") ; fflush (stdout) ;
for (;;)
{
led = rand () % 4 ;
light (led, 1) ;
delay (10) ;
light (led, 0) ;
button = 0 ;
for (j = 0 ; j < 4 ; ++j)
button += digitalRead (PIFACE + j) ;
if (button != 4)
break ;
}
waitForNoButtons () ;
printf ("Wait for it ... ") ; fflush (stdout) ;
led = rand () % 4 ;
delay (rand () % 500 + 1000) ;
light (led, 1) ;
start = millis () ;
for (button = -1 ; button == -1 ; )
{
for (j = 0 ; j < 4 ; ++j)
if (digitalRead (PIFACE + j) == 0) // Pushed
{
button = j ;
break ;
}
}
stop = millis () ;
button = 3 - button ; // Correct for the buttons/LEDs reversed
light (led, 0) ;
waitForNoButtons () ;
light (led, 1) ;
if (button == led)
{
printf ("You got it in %3d mS\n", stop - start) ;
}
else
{
printf ("Missed: You pushed %d - LED was %d\n", button, led) ;
for (;;)
{
light (button, 1) ;
delay (100) ;
light (button, 0) ;
delay (100) ;
i = 0 ;
for (j = 0 ; j < 4 ; ++j)
i += digitalRead (PIFACE + j) ;
if (i != 4)
break ;
}
waitForNoButtons () ;
}
light (led, 0) ;
delay (4000) ;
}
return 0 ;
}