wordclock/wordclock/French.h

270 lines
9.7 KiB
C

/**************************************************************************
* *
* W O R D C L O C K - A clock that tells the time using words. *
* *
* FRENCH VERSION - thanks to Lionel Martin for testing *
* *
* *
* Hardware: Arduino Dumelove with a set of individual LEDs under a word *
* stencil. *
* Copyright (C) 2009,2010,2011 Doug Jackson (doug@doughq.com) *
* *
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
* *
***************************************************************************
*
* Revision History
*
* Date By What
* 20110310 DRJ Modified to French Language
*/
// Display output pin assignments
#define UNE Display1=Display1 | (1<<0); Serial.print("une ");
#define DEUX Display1=Display1 | (1<<1); Serial.print("duex ");
#define TROIS Display1=Display1 | (1<<2); Serial.print("trois ");
#define QUATRE Display1=Display1 | (1<<3); Serial.print("quatre ");
#define MCINQ Display1=Display1 | (1<<4); Serial.print("mcinq ");
#define SIX Display1=Display1 | (1<<5); Serial.print("six ");
#define SEPT Display1=Display1 | (1<<6); Serial.print("sept ");
#define HUIT Display1=Display1 | (1<<7); Serial.print("huit ");
#define NEUF Display2=Display2 | (1<<0); Serial.print("neuf ");
#define HDIX Display2=Display2 | (1<<1); Serial.print("hdix ");
#define MINUIT Display2=Display2 | (1<<2); Serial.print("minuit ");
#define MIDI Display2=Display2 | (1<<3); Serial.print("midi ");
#define ONZE Display2=Display2 | (1<<4); Serial.print("onze ");
#define HEURE Display2=Display2 | (1<<5); Serial.print("heure ");
#define S Display2=Display2 | (1<<6); Serial.print("s ");
#define MOINS Display2=Display2 | (1<<7); Serial.print("moins ");
#define LE Display3=Display3 | (1<<0); Serial.print("le ");
#define MDIX Display3=Display3 | (1<<1); Serial.print("mdix ");
#define ET Display3=Display3 | (1<<2); Serial.print("et ");
#define QUART Display3=Display3 | (1<<3); Serial.print("quart ");
#define VINGT Display3=Display3 | (1<<4); Serial.print("vingt ");
#define DASH Display3=Display3 | (1<<5); Serial.print("- ");
#define HCINQ Display3=Display3 | (1<<6); Serial.print("hcinq ");
#define DEMIE Display3=Display3 | (1<<7); Serial.print("demie ");
#define LED1 Led1=1; Serial.print("MINLED1 ")
#define LED2 Led2=1; Serial.print("2 ")
#define LED3 Led3=1; Serial.print("3 ")
#define LED4 Led4=1; Serial.print("4 ")
void selftest(void){
// start by clearing the display to a known state
ledsoff();
Serial.println("Start Self Test ");
UNE; delay(500); ledsoff();
DEUX; delay(500); ledsoff();
TROIS; delay(500); ledsoff();
QUATRE; delay(500); ledsoff();
MCINQ; delay(500); ledsoff();
SIX; delay(500); ledsoff();
SEPT; delay(500); ledsoff();
HUIT; delay(500); ledsoff();
NEUF; delay(500); ledsoff();
MDIX; delay(500); ledsoff();
MINUIT; delay(500); ledsoff();
MIDI; delay(500); ledsoff();
ONZE; delay(500); ledsoff();
HEURE; delay(500); ledsoff();
S; delay(500); ledsoff();
MOINS; delay(500); ledsoff();
LE; delay(500); ledsoff();
HDIX; delay(500); ledsoff();
ET; delay(500); ledsoff();
QUART; delay(500); ledsoff();
VINGT; delay(500); ledsoff();
DASH; delay(500); ledsoff();
HCINQ; delay(500); ledsoff();
DEMIE; delay(500); ledsoff();
LED1; delay(500); ledsoff();
LED2; delay(500); ledsoff();
LED3; delay(500); ledsoff();
LED4; delay(500);
Serial.println(" ");
for(int i=0; i<5; i++)
{
Display1=255;
Display2=255;
Display3=255;
delay(500);
ledsoff();
delay(500);
}
Serial.println("End Self Test");
}
void displaytime(void){
/**************************************************************************
Display is performed using word strings such as:
IL EST UNE HEURE - It is One O'clock
IL EST UNE HEURE ET DEMI - It is One thirty
IL EST TROIS HEURES - It is Three Thirty
IL EST QUATRE HEURES VINGT - It is Twenty minutes past Four
IL EST QUATRE HEURES MOINS VINGT - It is Twenty Minutes to Four
Display Logic:
HEURE is displayed when hours is Singular
S (After HEURE) is displayed when hours is plural - and not midday or midnight
MOINS is displayed between xx:35 and xx:59
CINQ is displayed at xx:05, xx:25, xx:35 and xx:55
- is displayed at xx:25 and xx:35
ET (before QUART) is displayed at xx:15
LE is displayed at xx:45
UNE is displayed between 01:00-01:59 and 13:00-13:59
DEUX is displayed between 02:00-02:59 and 14:00-14:59
TROIS is displayed between 03:00-03:59 and 15:00-15:59
QUATRE is displayed between 04:00-04:59 and 16:00-16:59
CINQ is displayed between 05:00-05:59 and 17:00-17:59
SIX is displayed between 06:00-06:59 and 18:00-18:59
SEPT is displayed between 07:00-09:59 and 19:00-19:59
HEUT is displayed between 08:00-09:59 and 20:00-20:59
NEUF is displayed between 09:00-09:59 and 21:00-21:59
DIX is displayed between 10:00-10:59 and 22:00-22:59
ONZE is displayed between 11:00-11:59 and 23:00-23:59
MIDI is displayed between 12:00-12:59
MINUIT is displayed between 00:00-00:59
DIX is displayed between xx:10-xx:14 and 0x:50-0x:54
QUART is displayed between xx:15-xx:19 and xx:45-xx:49
VINGT is displayed between xx:20-xx:29 and xx:35-xx:44
ET-DEMI is displayed between xx:30 and xx:34
*/
// start by clearing the display to a known state
ledsoff();
// IL-EST is hard wired to stay on as we only have 24 outputs
Serial.print("Il est ");
if ((minute>=0) && (minute<35)) switch (hour) {
case 1: UNE; HEURE; break;
case 2: DEUX; HEURE; S; break;
case 3: TROIS; HEURE; S; break;
case 4: QUATRE; HEURE; S; break;
case 5: HCINQ; HEURE; S; break;
case 6: SIX; HEURE; S; break;
case 7: SEPT; HEURE; S; break;
case 8: HUIT; HEURE; S; break;
case 9: NEUF; HEURE; S; break;
case 10: HDIX; HEURE; S; break;
case 11: ONZE; HEURE; S; break;
case 12: MIDI; break;
case 13: UNE; HEURE; break;
case 14: DEUX; HEURE; S; break;
case 15: TROIS; HEURE; S; break;
case 16: QUATRE; HEURE; S; break;
case 17: HCINQ; HEURE; S; break;
case 18: SIX; HEURE; S; break;
case 19: SEPT; HEURE; S; break;
case 20: HUIT; HEURE; S; break;
case 21: NEUF; HEURE; S; break;
case 22: HDIX; HEURE; S; break;
case 23: ONZE; HEURE; S; break;
case 00: MINUIT; break;
case 24: MINUIT; break;
}
else switch (hour) {
case 0: UNE; HEURE; break;
case 1: DEUX; HEURE; S; break;
case 2: TROIS; HEURE; S; break;
case 3: QUATRE; HEURE; S; break;
case 4: HCINQ; HEURE; S; break;
case 5: SIX; HEURE; S; break;
case 6: SEPT; HEURE; S; break;
case 7: HUIT; HEURE; S; break;
case 8: NEUF; HEURE; S; break;
case 9: HDIX; HEURE; S; break;
case 10: ONZE; HEURE; S; break;
case 11: MIDI; break;
case 12: UNE; HEURE; break;
case 13: DEUX; HEURE; S; break;
case 14: TROIS; HEURE; S; break;
case 15: QUATRE; HEURE; S; break;
case 16: HCINQ; HEURE; S; break;
case 17: SIX; HEURE; S; break;
case 18: SEPT; HEURE; S; break;
case 19: HUIT; HEURE; S; break;
case 20: NEUF; HEURE; S; break;
case 21: HDIX; HEURE; S; break;
case 22: ONZE; HEURE; S; break;
case 23: MINUIT; break;
}
// now we display the appropriate minute counter
if ((minute>4) && (minute<10)) { MCINQ; }
if ((minute>9) && (minute<15)) { MDIX; }
if ((minute>14) && (minute<20)) { ET; QUART; }
if ((minute>19) && (minute<25)) { VINGT; }
if ((minute>24) && (minute<30)) { VINGT; DASH; MCINQ; }
if ((minute>29) && (minute<35)) { ET; DEMIE; }
if ((minute>34) && (minute<40)) { MOINS; VINGT; DASH; MCINQ; }
if ((minute>39) && (minute<45)) { MOINS; VINGT; }
if ((minute>44) && (minute<50)) { MOINS; LE; QUART; }
if ((minute>49) && (minute<55)) { MOINS; MDIX; }
if ((minute>54) && (minute<60)) { MOINS; MCINQ; }
Serial.print(" ");
// now we can illuminate the extra minute LEDs
if ((minute-(minute/5)*5)==1) {
LED1;
}
if ((minute-(minute/5)*5)==2) {
LED1;
LED2;
}
if ((minute-(minute/5)*5)==3) {
LED1;
LED2;
LED3;
}
if ((minute-(minute/5)*5)==4) {
LED1;
LED2;
LED3;
LED4;
}
}