ExtensionLedsMSI/vumetre.ino

25 lines
446 B
C++

int val = 0;
int i = 0;
int vumetre[] = {5, 15, 20, 35, 45, 70, 90, 100};
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
for (i = 6; i<= 13; i++) {
pinMode(i, OUTPUT); }
}
void loop() {
val = analogRead(A0);
Serial.println(val);
for ( i = 0; i<= 7; i++ ) {
if ( vumetre[i] < val)
digitalWrite (i + 6 , HIGH);
}
delay(20);
for ( i = 0; i <= 7; i++ ) {
digitalWrite (i + 6 , LOW);
}
}