Advertisement
Zoff76

Potméteres LEDvillogtatás Arduinoval

Jan 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. // potméters led villogtatás
  2.  
  3. int led = 13;
  4. int potpin = A0;
  5. int pot = 0;
  6.  
  7. void setup() {
  8.   // put your setup code here, to run once:
  9.  
  10.   pinMode (led, OUTPUT);
  11.   Serial.begin(9600);
  12.  
  13. }
  14.  
  15. void loop() {
  16.   // put your main code here, to run repeatedly:
  17.  
  18.   pot = analogRead(potpin);
  19.  
  20.   Serial.println(pot);
  21.   digitalWrite (led, HIGH);
  22.   delay (pot);
  23.  
  24.   digitalWrite (led, LOW);
  25.   delay (pot); //a poti adja a villogások közti időt
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement