Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int seuil=2000;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- pinMode(9, OUTPUT);
- pinMode(7, OUTPUT);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- digitalWrite(9, HIGH);
- delay(1000); //DELAI AVANT DEBUT
- int x;
- x = analogRead(A0);
- if (x>seuil) {
- digitalWrite(7, HIGH); // allume le moteur
- }
- else {
- digitalWrite(7, LOW); // éteint le moteur
- }
- Serial.println(x);
- delay(10);
- }
- // pin 9 = led
- //pin 7 = moteur on/off (transsitor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement