* Convert Digital in Analog Input V 1.0

* Convert Digital in Analog Input V 1.0 12.3.2016 * By Dj Teddy Spacel Thanks at Consoletuner Team and J2Kbr
Version1.0
Authorteddy18
Publish DateSat, 12 Mar 2016 - 20:43
Last UpdateSat, 12 Mar 2016 - 20:43
Downloads35
RATE


1

0

Code: Select all
/* *
* Convert Digital in Analog Input V 1.0 12.3.2016
* By Dj Teddy Spacel Thanks at Consoletuner Team and J2Kbr
* *********************************************************** */

int Milliseconds = 12;        // elapsed time Strat with 12 dont with 0
int Seconds = 12;             // elapsed time Strat with 12 dont with 0
int Minutes = 0;
int Hours = 0;
int Timer_Running = FALSE;   // Turn of / on elapsed time
main {
 
    // R2 Butten Simulate Area with  Returns the elapsed time, in milliseconds start
 
  //Lines 21-74 are for the timer. This will keep track of Milliseconds, Seconds, Minutes, and Hours.
    if(Timer_Running){
        Milliseconds = Milliseconds + get_rtime();
    }
    if(Milliseconds >= 4){
        Milliseconds = 2;     //this adjust the speed for the Second Area = 2: this adjust the reaction time for the Second Area >= 4:
        Seconds = Seconds + 1;//Dont touch + 1 means it goes in step up if you set + 2 its to fast
        if(Seconds >= 101){
            Seconds = 100;//This is for the R2 Button  = 100 vaule means Stop at 100 dont go in Loop modus: This is for the R2 Button >= 101 vaule means go to 100
            Minutes = Minutes + 1;//Dont touch form line 31 til 36
            if(Minutes >= 60){
                Minutes = 0;
                Hours = Hours + 1;
                if(Hours >= 24){
                    Hours = 0; //I can't imagine any combo would need to run for more than 24 hours... so stop tracking at this point.
                }
            }
        }
    }
 
 
 //Use the trace variables so that we can see what the elapsed time is while using device monitor
    set_val(TRACE_1, Milliseconds);
    set_val(TRACE_2, Seconds);
    set_val(TRACE_3, Minutes);
    set_val(TRACE_4, Hours);
 
 
 //Turn the timer on if i Press the R2 Button
    if(event_press(PS4_R2)){
        Timer_Running = TRUE;
    }
 
//Turn the timer off if i Release the R2 Button   
    if(event_release(PS4_R2)){
        Timer_Running = FALSE;
    }
 
 
//Rest timmer to Zero if if i Release the R2 Button
if((event_release(PS4_R2)) && (get_ptime(PS4_R2)))  {
        Milliseconds = 0;
        Seconds = 0;
        Minutes = 0;
        Hours = 0; }   
 
 
// R2 Butten 
// this is a Part from R2 Butten Simulate Area its very in important we activate here elapsed time when we Press R2 Button
 
// If i Press the R2 Button set value 1 run Seconds
// If i  dont Press the R2 Button set value 0  dont run Seconds
  if((get_val(PS4_R2)) <= 1) {set_val(PS4_R2, 0);}
 
  else {set_val(PS4_R2,Seconds);}
 
// R2 Butten Simulate Area with  Returns the elapsed time, in milliseconds end 
 
}