Bombinette factice airsoft arduino . Manque bip touche clavier.

Bonjour a tous !

je suis debutant en arduino, et j'aurai besoin de vous pour modifier un programme que j'ai deja un peu modif .

j'aimerai avoir juste un son a chaque touche du clavier matriciel . J'ai essayé deja pas mal de chose mais pas de resultat..

merci d'avance si quel'qu'un a une idee . je depose le code en trois parties juste apres .

kryloris:
je suis debutant en arduino, et j'aurai besoin de vous pour modifier un programme que j'ai deja un peu modif .

j'aimerai avoir juste un son a chaque touche du clavier matriciel . J'ai essayé deja pas mal de chose mais pas de resultat..

bonsoir
met ton code entre balises code #

En plus le code est pas entier

Bonsoir , le code est trop long donc je le met en trois parties :

1ere partie .

/********************************************************************************
**********
* Airsoft C4 Prop by Joshua Burgess
* v2 modify by PIC-PAC
* 13/08/2013
********************************************************************************
***********/

/********************************************************************************
**********
*
* TO DO
* ajouter option fil à couper
********************************************************************************
***********/

#include <Keypad.h>

#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
// set up the LCD's number of columns and rows:


const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {A1, A2, A3, A4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 6, 7}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

//Define all the bomb states
#define READY 0
#define ARMED 1
#define DISARMED 2
#define DETONATED 3
#define speakerPin 2

int second=30, minute=1, hour=0; // declare time variables
int bombState=0; //0 = Ready, 1 = Armed, 2 = Disarmed, 3 = detonated
int repeat=0;//flag to prevent repeat of getArmCode();
int repeatAdm=0; //flag to prevent repeat of getAadminCode();
int repeatDisarm=0;//flag to prevent repeat of getDisarmCode();
int repeatBuzzer=0;//flag to prevent buzzer from running multiple times.
int repeatTimerEdit=0;//flag to prevent repeat of timer edit function
//int speakerPin = 2;//pin that the piezo buzzer is connected to.
int blinkArmed = 0; // flag for blink text
int blinkDisarmed = 0; // flag to blink disarmed msg
int nbBlinkDisarmed = 6; // flag for number of blink disarmed msg (real number of blink = nbBlinkDisarmed / 2)
long previousTime = 0;//holds previous time in ms
long previousDelay = 0;//holds previous time in ms since buzzer was active
long interval = 60000;//60 second delay

char hour_str[4]; // For Convert int in char
char minute_str[4]; // For Convert int in char
char second_str[4]; // For Convert int in char
char timeInt_str[0]; // For Convert int in char
char newcode_str[0];
char newarmcode_str[0];
char newdisarmcode_str[0];


char ArmCode[] = "123456";//code to arm the bomb
char disarmCode[] = "123456";//code to disarm the bomb
char adminCode[] = "123456";//code to change timer

char ENTER_KEY = '#';
char CANCEL_KEY = '*';//stores the cancel key variable.
char timeSetKey = '*';//key to press to set the code.

void setup()
{lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(2, 0 );
lcd.print( "Bombe Factice" );
lcd.setCursor( 3, 1 );
lcd.print( "GOOD GAME" );
delay(2000);
lcd.setCursor( 2, 0 );
lcd.print( "Bombe Factice" );
lcd.setCursor( 3, 1 );
lcd.print( "BY PIC-PAC" );
delay(2000);
lcd.clear();
////backlightOn();
//blinkCursor();
//stopVscroll();
pinMode(speakerPin, OUTPUT);//sets the output pin for the piezo buzzer
}

void loop(){
switch (bombState) {
lcd.clear();

/***********************************************************
*Ready state prepares bomb, waits for arm code to be input
*
************************************************************/
case READY:
int resultOfGetArmCode;
lcd.clear();
lcd.setCursor(0, 0 );
delay(100);
//showCursor();
//blinkCursor();

lcd.print("Enter ArmCode :"); //Notify user of status.
resultOfGetArmCode = getArmCode();

if (resultOfGetArmCode == 1) {
lcd.clear();
lcd.setCursor(0, 0 );
delay(100);
lcd.print("Correct");
delay(500);
lcd.clear();
bombState = ARMED; //Start countdown

}//Close getArmCode(); = true

if (resultOfGetArmCode == 0) { //if code fails print "Incorrect"
tryAgainMsg();

}// Close getArmCode(); = false.

break;

/**************************************************
*Armed state. Countdown starts, waits for pushbutton to be pressed.
*If button is pressed, wait for code from keypad.
***************************************************/

case ARMED:
{
char disarmKey = keypad.getKey();

if (disarmKey == '#') {
char reslutOfDisarm;
lcd.clear();
lcd.setCursor(0, 0 );

delay(100);
lcd.print("Enter DisarmCode"); //if disarm button is pressed, ask user to input code.
reslutOfDisarm = getDisarmCode();

if (reslutOfDisarm == true) {
lcd.clear();
bombState = DISARMED; //and set bombState to disarmed.
break;
} //close getDisarmCode(); = True


if (reslutOfDisarm == false) {
tryAgainMsg();

if (second >= 15) {
second = second - 15;
}

else {
if (minute == 0 && hour == 0) {
second=1; //detonate.
}
if (minute > 0) {
second = 60 - (15 - second);
minute = minute - 1;
}

if (hour > 0 && minute == 0) {
second = 60 - (15 - second);
minute = 59;
hour = hour - 1 ;
}
}
} //close getDisarmCode(); = false
} //close if

}
countdown(); //if disarm key has not been pressed, continue countdown.

break;

/**************************************************************
*DISARMED. Counter stopped, displays "bomb disarmed"
*
**************************************************************/

case DISARMED:
int blinkDisarmFlag;
blinkDisarmFlag = 0;

//hideCursor();

for (nbBlinkDisarmed; nbBlinkDisarmed > 0; nbBlinkDisarmed--){ // blink msg
if (blinkDisarmFlag == 1){
lcd.setCursor(2, 0 );
lcd.print("BOMB DISARMED"); //bomb has been disarmed, inform user.
lcd.setCursor(2, 1 );
lcd.print("GOOD JOB TEAM");
delay(1000);
lcd.setCursor(2, 0 );
lcd.print("GOOD JOB TEAM"); //bomb has been disarmed, inform user.
lcd.setCursor(2, 1 );
lcd.print("BOMB DISARMED");
delay(9000);


asm volatile (" jmp 0");
blinkDisarmFlag = 0;

}
else{
lcd.clear();
delay(1000);
blinkDisarmFlag = 1;
}
} // end blink
break;

/*******************************************************
*Detonated. activate buzzer for 8 beeps, then 1 long.
*Print "Have A Nice Day. to LCD.
********************************************************/

case DETONATED:
if (repeatBuzzer == 0) { //make sure buzzer for loop has not already been run.

digitalWrite(speakerPin, HIGH);//turn on buzzer
lcd.setCursor(0, 0 );
lcd.print("BOOOOOOOOOOOOOOM"); //loop message informing user of bomb detonation.
//lcd.setCursor(0, 1 );
//lcd.print("Have A Nice Day"); //loop message informing user of bomb detonation.
delay(5000);//wait 5 seconds
digitalWrite(speakerPin, LOW);//turn off buzzer
repeatBuzzer = 1;//set flag to prevent code from looping again.
}

else {
//lcd.setCursor(0, 0 );
//lcd.print("BOOOOOOOOOOOOOOM"); //loop message informing user of bomb detonation.
lcd.setCursor(0, 1 );
lcd.print("Have A Nice Day"); //loop message informing user of bomb detonation.
delay(9000);


asm volatile (" jmp 0");

}

}//closes switch
}//closes loop
/*void software_Reset()
{
}*/
/***********************************************************
* Main countdown timer *
* countdown() *
************************************************************/
void countdown(){

static unsigned long lastTick = 0; // set up a local variable to hold the last time we decremented one second
static unsigned long currentMillis = 0;
// (static variables are initialized once and keep their values between function calls)

// decrement one second every 1000 milliseconds
if (second > 0) {
if (millis() - lastTick >= 1000) {
lastTick = millis();
second--;
 tone(3,4699,100);
serialOutput();
}
}

// decrement one minute every 60 seconds
if (minute > 0) {
if (second <= 0) {
minute--;
second = 60; // reset seconds to 60

}
}

// decrement one hour every 60 minutes
if (hour > 0) {
if (minute <= 0) {
hour--;
minute = 60; // reset minutes to 60
}//closes if
}//closes if


//the code below beeps the siren once every minute.
currentMillis = millis();
if (currentMillis - previousTime > interval)
{
previousTime = currentMillis;
previousDelay = currentMillis;

digitalWrite(speakerPin, HIGH);//turn on buzzer
}

if (currentMillis - previousDelay > 100) {//100ms chirp duration
digitalWrite(speakerPin, LOW);//turn off buzzer
}
} //close countdown();

2 eme partie :

/***********************************************************************
* getArmCode(); *
* Grabs the code to arm the bomb from the keypad. *
* *
************************************************************************/
boolean getArmCode(){
// returns true when all PW keys are pressed in sequence
// returns false when number of keys in pW pressed but don't exactly match the PW
// CANCEL_KEY erases all previous digits input
int count=0; // how many keys we have
int matchCount=0; // how many keys match
lcd.setCursor(0, 1 );

if(repeat == 0){

for(count=0, matchCount=0; count < sizeof(ArmCode)-1; count++){
char key;
char key_str[0]; // Define as string

do{
key = keypad.getKey();
}
while(key == '\0');

key_str[0] = key;
lcd.print(key_str);

if (key == timeSetKey && repeatTimerEdit == 0){
// ***************** MOD HERE ********************* ============> Random codes for arm & disarm
timerSet();
return 2;
}

if(key == ArmCode[count]) {
matchCount++;
}

else if(key == CANCEL_KEY){
count=0;
matchCount=0;
return 0;
}
}//close for loop
}//close repeat flag check

// here when the same number of keys pressed as characters in the PW
if(matchCount == count) {
repeat=1;
return 1;
}

else {
return 0;
}
}//close getArmCode();


/**********************************************************************
* getDisarmCode(); *
* Gets disarm code from keypad. *
* *
***********************************************************************/
boolean getDisarmCode(){

// returns true when all PW keys are pressed in sequence
// returns false when number of keys in pW pressed but don't exactly match the PW
// CANCEL_KEY erases all previous digits input

int count=0; // how many keys we have
int matchCount=0; // how many keys match
long disarmTime = millis()+7000L;//7000 instead of 15000 b/c of added delays making total 30s

lcd.setCursor(0, 1 );
//showCursor();
//blinkCursor();

if(repeatDisarm == 0){

for(count=0, matchCount=0; count < sizeof(disarmCode)-1; count++){
char key;
char key_str[0]; // Define as string

do{
if(disarmTime < millis()){ //if 15 seconds have passed, bail out
break;
}

key = keypad.getKey();
delay (100);
}
while(key == '\0');

key_str[0] = key;
lcd.print(key_str);

if(key == disarmCode[count]) {
matchCount++;
}

else if(key == CANCEL_KEY){
count=0;
matchCount=0;
return false;
}

if(disarmTime < millis()) {
return false;
break;
}

}// close for loop
} //close repeat flag check

// here when the same number of keys pressed as characters in the PW
if(matchCount == count) {
repeatDisarm=1;
return true;
}
else {
return false;

}
}//close getDisarmCode();


/**********************************************************************
* getAdminCode(); *
* Gets admin code from keypad. *
* *
***********************************************************************/
boolean getAdminCode(){

// returns true when all PW keys are pressed in sequence
// returns false when number of keys in pW pressed but don't exactly match the PW
// CANCEL_KEY erases all previous digits input

int count=0; // how many keys we have
int matchCount=0; // how many keys match

lcd.setCursor(0, 1 );


for(count=0, matchCount=0; count < sizeof(adminCode)-1; count++){
char key;
char key_str[0]; // Define as string

do{
key = keypad.getKey();
delay (100);
}
while(key == '\0');

// itoa(key, key_str,10);
key_str[0] = key;
lcd.print(key_str);
// lcd.print(itoa(key, key_str,16));


if(key == adminCode[count]) {
matchCount++;
}

else if(key == CANCEL_KEY){
count=0;
matchCount=0;
return false;
}

}// close for loop

// here when the same number of keys pressed as characters in the PW
if(matchCount == count) {
return true;
}
else{
return false;
}
// Do nothing if pwd is false / Parent function send tryAgin msg
}//close getAdminCode();


/*********************************************************************
* Timer edit function *
* *
* *
**********************************************************************/
void timerSet(){
lcd.clear();
lcd.print("Enter AdminCode");
char resultOfGetAdmCode;

resultOfGetAdmCode = getAdminCode();

if (resultOfGetAdmCode == true){
char timeInt;
char newcode;
char newarmcode;
char newdisarmcode;
char menupage;
int newadmincode;
lcd.clear();
lcd.setCursor(0, 0 );
lcd.print("1.Admin 2.Time");
lcd.setCursor(0, 1 );
lcd.print("3.Arm 4.Disarm");
do{
menupage = keypad.getKey();
}
while(menupage == '\0' || menupage == '*' || menupage == '0' || menupage > 52);

switch(menupage) {
case '1': // Edit admin code
lcd.clear();
lcd.setCursor(0, 0 );
lcd.print("new admin code :");
lcd.setCursor(0, 1 );
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[0] = newcode_str[0];
newadmincode = (newcode - '0') * 10;//get first digit and convert to int
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[1] = newcode_str[0];
newadmincode = (newcode - '0') + newadmincode;//get second digit.
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[2] = newcode_str[0];
newadmincode = (newcode - '0') + newadmincode;//get 3rd digit.
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[3] = newcode_str[0];
newadmincode = (newcode - '0') + newadmincode;//get 4th digit.
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[4] = newcode_str[0];
newadmincode = (newcode - '0') + newadmincode;//get 5th digit.
do{
newcode = keypad.getKey();
delay (100);
}
while(newcode == '\0');
newcode_str[0] = newcode;
lcd.print(newcode_str);
adminCode[5] = newcode_str[0];
newadmincode = (newcode - '0') + newadmincode;//get 6th digit.

//newcode = 'L';


lcd.clear();

lcd.setCursor(0, 0 );
lcd.print("NEW ADMINCODE");
lcd.setCursor(0, 1 );
lcd.print(adminCode);
delay(5000);
lcd.clear();

break;

case '3': // Edit armcode
lcd.clear();
lcd.setCursor(0, 0 );
lcd.print("new armcode :");
lcd.setCursor(0, 1 );
do{
newarmcode = keypad.getKey();
delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[0] = newarmcode_str[0];
newarmcode = (newarmcode - '0') * 10;//get first digit and convert to int
do{
newarmcode = keypad.getKey();
delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[1] = newarmcode_str[0];
newarmcode = (newarmcode - '0') + newarmcode;//get second digit.
do{
newarmcode = keypad.getKey();delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[2] = newarmcode_str[0];
newarmcode = (newarmcode - '0') + newarmcode;//get 3rd digit.
do{
newarmcode = keypad.getKey();
delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[3] = newarmcode_str[0];
newarmcode = (newarmcode - '0') + newarmcode;//get 4th digit.
do{
newarmcode = keypad.getKey();
delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[4] = newarmcode_str[0];
newarmcode = (newarmcode - '0') + newarmcode;//get 5th digit.
do{
newarmcode = keypad.getKey();
delay (100);
}
while(newarmcode == '\0');
newarmcode_str[0] = newarmcode;
lcd.print(newarmcode_str);
ArmCode[5] = newarmcode_str[0];
newarmcode = (newarmcode - '0') + newarmcode;//get 6th digit.

//newcode = 'L';

3 eme parties :

lcd.clear();

lcd.setCursor(0, 0 );
lcd.print("NEW ARMCODE");
lcd.setCursor(0, 1 );
lcd.print(ArmCode);
delay(5000);
lcd.clear();

break;

case '4': // Edit disarmcode
lcd.clear();
lcd.setCursor(0, 0 );
lcd.print("new disarmcode :");
lcd.setCursor(0, 1 );
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[0] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') * 10;//get first digit and convert to int
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[1] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') + newdisarmcode;//get second digit.
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[2] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') + newdisarmcode;//get 3rd digit.
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[3] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') + newdisarmcode;//get 4th digit.
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[4] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') + newdisarmcode;//get 5th digit.
do{
newdisarmcode = keypad.getKey();
delay (100);
}
while(newdisarmcode == '\0');
newdisarmcode_str[0] = newdisarmcode;
lcd.print(newdisarmcode_str);
disarmCode[5] = newdisarmcode_str[0];
newdisarmcode = (newdisarmcode - '0') + newdisarmcode;//get 6th digit.

//newcode = 'L';


lcd.clear();

lcd.setCursor(0, 0 );
lcd.print("NEW DISARMCODE");
lcd.setCursor(0, 1 );
lcd.print(disarmCode);
delay(5000);
lcd.clear();

break;

case '2': // Timer
lcd.clear();
lcd.print("Enter xx Hours");
lcd.setCursor(0, 1 );
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0' || timeInt < '0' || timeInt > '6');
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);

hour = (timeInt - '0') * 10;//get first digit and convert to int
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0');
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);

hour = (timeInt - '0') + hour;//get second digit.
delay(800);
lcd.clear();
timeInt = 'L';
// ------------------------------------------------------------------
lcd.print("Enter xx Minutes");
lcd.setCursor(0, 1 );
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0' || timeInt < '0' || timeInt > '6');
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);

while (timeInt < '0' || timeInt > '6'){
timeInt = keypad.getKey();
}
minute = (timeInt - '0') * 10;//get first digit and convert to int
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0');
minute = (timeInt - '0') + minute;//get second digit.
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);
delay(800);
lcd.clear();
timeInt = 'L';
// ------------------------------------------------------------------
lcd.print("Enter xx Seconds");
lcd.setCursor(0, 1 );
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0' || timeInt < '0' || timeInt > '6');
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);

while (timeInt < '0' || timeInt > '6'){
timeInt = keypad.getKey();
}
second = (timeInt - '0') * 10;//get first digit and convert to int
do{
timeInt = keypad.getKey();
}
while(timeInt == '\0');
second = (timeInt - '0') + second;//get second digit.
timeInt_str[0] = timeInt;
lcd.print(timeInt_str);
delay(800);
lcd.clear();
timeInt = 'L';
lcd.print("Time set :");
lcd.setCursor(0, 1 );
itoa (hour, hour_str, 10);
itoa (minute, minute_str, 10);
itoa (second, second_str, 10);
lcd.print(hour_str);
lcd.print(":");
lcd.print(minute_str);
lcd.print(":");
lcd.print(second_str);
delay(2000);
// ---------------------- Put randomize here --------------------------
repeatTimerEdit = 1;
}//end of getAdminCode == true

if(resultOfGetAdmCode == false){
tryAgainMsg();
// Do nothing if pwd is false / Parent function send tryAgin msg

}
lcd.clear();
}//end of timer edit function
}



/****************************************************************
* serialOutput(); *
* prints the values of the timer over the serial connection *
* and onto the LCD *
*****************************************************************/
void serialOutput() {


itoa (hour, hour_str, 10);
itoa (minute, minute_str, 10);
itoa (second, second_str, 10);


if(bombState != DISARMED){

lcd.setCursor(0, 0 );
delay(20);
if (blinkArmed == 0){
lcd.print("!! ARMED !!");
blinkArmed=1;
}
else {
lcd.print("!! !!");
blinkArmed=0;
}
lcd.setCursor(0, 1 );

lcd.print("Time = ");
if (hour <=9) {
lcd.print("0");
lcd.print(hour_str); // the hour, sent to the screen in decimal format
}
else{
lcd.print(hour_str);
}
lcd.print(":"); // a colon between the hour and the minute
if (minute <=9) {
lcd.print("0");
lcd.print(minute_str); // the minute, sent to the screen in decimal format
}
else{
lcd.print(minute_str);
}
lcd.print(":"); // a colon between the minute and the second
if (second <=9) {
lcd.print("0");
lcd.print(second_str); // the minute, sent to the screen in decimal format
}
else{
lcd.print(second_str);
}
//termination condition
}
if (second == 0 && minute == 0 && hour == 0) {
lcd.clear();

bombState = DETONATED; //clear LCD and set bomb state to "detonated" when timer runs out
}

if (bombState == DISARMED) {
lcd.clear();
}
}//close serialOutput();


void tryAgainMsg(){
lcd.clear();
//hideCursor();
delay(100);
lcd.print("T");
delay(150);
lcd.print("r");
delay(150);
lcd.print("y");
delay(150);
lcd.print(" ");
delay(150);
lcd.print("a");
delay(150);
lcd.print("g");
delay(150);
lcd.print("a");
delay(150);
lcd.print("i");
delay(150);
lcd.print("n");
delay(150);
lcd.print(" ");
delay(150);
lcd.print("!");
delay(1000);
}

void incorrectMsg(){
lcd.clear();

delay(100);
lcd.print("I");
delay(350);
lcd.print("n");
delay(350);
lcd.print("c");
delay(350);
lcd.print("o");
delay(350);
lcd.print("r");
delay(350);
lcd.print("r");
delay(350);
lcd.print("e");
delay(350);
lcd.print("c");
delay(350);
lcd.print("t");
delay(1000);
}
//END of bomb program.

Suffit de mettre un tone() après chaque getKey()

j'ai mis
disarmKey = keypad.getKey();
tone(3,4699);
delay(100);
noTone(3);

key = keypad.getKey();
tone(3,4699);
delay(100);
noTone(3);

Ou bien simplement j'ai mis tone(3,4699,100); apres mais cela fais soit un bip continu ou un bip en boucle .

Je dois mal m'y prendre . Pouvez vous me donner plus de detail si possible ? merci

C'est bon j'ai trouvé comme un grand !

boolean getArmCode(){
// returns true when all PW keys are pressed in sequence
// returns false when number of keys in pW pressed but don't exactly match the PW
// CANCEL_KEY erases all previous digits input
int count=0; // how many keys we have
int matchCount=0; // how many keys match
lcd.setCursor(0, 1 );

if(repeat == 0){

for(count=0, matchCount=0; count < sizeof(ArmCode)-1; count++){
tone(3,4699,100);

Et oui faut mettre une durée :wink:

Bonjour a vous !

Je ré up le sujet,car j'ai la même base de code que toi ^^ et j'ai pas compris comment et ou tu as intégré le bout de code, peux tu m’éclairer?

merci ^^

Necrozia