diff --git a/vumetre.ino b/vumetre.ino new file mode 100644 index 0000000..96ad3fa --- /dev/null +++ b/vumetre.ino @@ -0,0 +1,24 @@ +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); + } +}