Demo entry 6353647

aa

   

Submitted by anonymous on Apr 02, 2017 at 17:34
Language: Arduino. Code size: 336 Bytes.

int val = 0; 
int preval=0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
 

}
int cnt=0;      
void loop() {
  // put your main code here, to run repeatedly:
  preval=val;
  val = analogRead(2);

cnt++;
if(cnt<150&&abs(preval-val)<50){
    delay(50);
  
}else{
  Serial.println(val);
  cnt=0;
}


}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).