Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 16th, 2012  |  syntax: C  |  size: 0.89 KB  |  views: 106  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. if(mode == 8) {
  2.     //analogWrite(rtrigPinout, 255);
  3.     digitalWrite(rtrigPinout, HIGH);
  4.    
  5.     ltrigValue = analogRead(ltrigPin);
  6.     // if ltrigValue is more than half
  7.     if (ltrigValue < 655) {
  8.         knobValue = analogRead(knobPin); //get the delay setting from the knob
  9.         //lets change the 1/5 to 1/4 or 1/8
  10.         knobDiv = knobValue>>2;  //knobDiv = knobValue/4
  11.         digitalWrite(ltrigPinout, HIGH);
  12.         unsinged int i = 0x0;
  13.         delay(40);
  14.         for(i=0;i<=knobValue;i=i+knobDiv){//0,1/4,1/2,3/4,1 == 5 times
  15.             delay(knobValue);
  16.             ltrigValue = analogRead(ltrigPin);
  17.             //should define a threshold rather than chose < 1
  18.             //in the case there is some noise on the trigger line
  19.             //#define THRESH 10
  20.             if(analogRead(ltrigPin)){
  21.                 break;
  22.             }
  23.         }
  24.         digitalWrite(ltrigPinout,LOW);
  25.     }
  26. }
clone this paste RAW Paste Data