Facebook
From zolty, 8 Years ago, written in C.
Embed
Download Paste or View Raw
Hits: 298
  1. void setup() {
  2.   // put your setup code here, to run once:
  3.   Serial.begin(9600);
  4.   for(int i=0;i<=9;i++)
  5.   {
  6.     pinMode(i,OUTPUT);
  7.   }
  8.   pinMode(A0,INPUT);
  9.  
  10.  
  11.  
  12. }
  13. int odczyt=0;
  14. void loop() {
  15.   // put your main code here, to run repeatedly:
  16.   for(int i=0;i<=9;i++)
  17.   {
  18.     odczyt=analogRead(A0);
  19.       digitalWrite(i-1,LOW);
  20.       digitalWrite(i,HIGH);
  21.       delay(odczyt/3);
  22.   }
  23.   for(int i=9;i>=0;i--)
  24.   {
  25.     odczyt=analogRead(A0);
  26.       digitalWrite(i+1,LOW);
  27.       digitalWrite(i,HIGH);
  28.       delay(odczyt/3);
  29.   }
  30.   Serial.println(analogRead(A0));
  31.  
  32. }
  33.