Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # P-11
- # Royal - Erve
- //Declaration de nos variables
- const int buttonPin = 2;
- const int ledPin = 12;
- int buttonState = 0;
- //Notre setup pour initialiser nos Pin
- void setup() {
- pinMode(ledPin, OUTPUT);
- pinMode(buttonPin, INPUT);
- }
- //Notre main qui bouclera à l'infini
- void loop(){
- buttonState = digitalRead(buttonPin); //On recupere l'état du button
- if(buttonState == HIGH) //On verifie si le button vaut 1
- {
- digitalWrite(ledPin, HIGH); //On allume la led
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement