bonjour, bein je continue...maintenant que j'ai intégré une interruption, j'ai bien réussi a récupérer mon impulsion mais je n'arrive pas a mes fin concernant le servo,
//leds ok relais ok mais pas servo
#include <Servo.h>
Servo myservo;
const int relayreed = 12; // pin 12 sortie pour reed appareil photo;
int impact = 0;
int ledPins[] = {14,15,16,17,18,19,8,10,11,};
void setup()
{
attachInterrupt( 0, mouche, RISING );
for(int i = 0; i < 9; i++){
pinMode(ledPins[i],OUTPUT);
pinMode(relayreed, OUTPUT);
myservo.attach(9); // servo sur pin 9
myservo.write(45); //initialise le servo en position repos zero
}
}
void loop()
{
if (impact == 1) { // si un choc a été détecté
photo();
}
{
oneAfterAnotherLoop();
}}
void photo(){
digitalWrite(relayreed, HIGH);
myservo.write(178); // va en butée inverse
delay(20); // pour stabilisation
myservo.write(45); // retour
digitalWrite(relayreed, LOW); // led OFF
delay(20); // pour stabilisation
impact = 0;
}
void mouche(){
impact = 1;
}
void oneAfterAnotherLoop(){
int delayTime = 100; //the time (in milliseconds) to pause between LEDs
//make smaller for quicker switching and larger for slower
//Turn Each LED on one after another
for(int i = 0; i <= 8; i++){
digitalWrite(ledPins[i], HIGH); //Turns on LED #i each time this runs i
delay(delayTime); //gets one added to it so this will repeat
} //8 times the first time i will = 0 the final
//time i will equal 7;
//Turn Each LED off one after another
for(int i = 8; i >= 0; i--){ //same as above but rather than starting at 0 and counting up
//we start at seven and count down
digitalWrite(ledPins[i], LOW); //Turns off LED #i each time this runs i
delay(delayTime); //gets one subtracted from it so this will repeat
} //8 times the first time i will = 7 the final
//time it will equal 0
}
donc j'ai mes p'tites lumières, ma photo mais pas de relevage,