Skip to content

Instantly share code, notes, and snippets.

@vanjikumaran
Created April 25, 2018 02:14
Show Gist options
  • Save vanjikumaran/9011d42a85e039ff2a3419fcd8389fb2 to your computer and use it in GitHub Desktop.
Save vanjikumaran/9011d42a85e039ff2a3419fcd8389fb2 to your computer and use it in GitHub Desktop.
int pintarray[] = {1,2,3,4,5,6,7,8,9,10};
int counter =0;
int timer=1000;
int sensorPin =A0;
void setup() {
counter=0;
pinMode(sensorPin,INPUT);
while(counter<10){
pinMode(pintarray[counter],OUTPUT);
counter++;
}
Serial.begin(9600);
}
void reset(){
counter=0;
while(counter<10){
digitalWrite(pintarray[counter],LOW);
counter++;
}
}
void loop() {
// reset();
// delay(timer);
int flexADC = analogRead(sensorPin);
if (flexADC>0){
Serial.println("Resistance: " + String(flexADC) + " ohms");
}
if (flexADC>9){
flexADC=10;
}
counter=0;
while(counter<flexADC){
digitalWrite(pintarray[counter],HIGH);
counter++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment