
Untitled
By: a guest on
Feb 16th, 2012 | syntax:
C | size: 0.89 KB | hits: 98 | expires: Never
if(mode == 8) {
//analogWrite(rtrigPinout, 255);
digitalWrite(rtrigPinout, HIGH);
ltrigValue = analogRead(ltrigPin);
// if ltrigValue is more than half
if (ltrigValue < 655) {
knobValue = analogRead(knobPin); //get the delay setting from the knob
//lets change the 1/5 to 1/4 or 1/8
knobDiv = knobValue>>2; //knobDiv = knobValue/4
digitalWrite(ltrigPinout, HIGH);
unsinged int i = 0x0;
delay(40);
for(i=0;i<=knobValue;i=i+knobDiv){//0,1/4,1/2,3/4,1 == 5 times
delay(knobValue);
ltrigValue = analogRead(ltrigPin);
//should define a threshold rather than chose < 1
//in the case there is some noise on the trigger line
//#define THRESH 10
if(analogRead(ltrigPin)){
break;
}
}
digitalWrite(ltrigPinout,LOW);
}
}