Posts by Nono

    Hi,

    I am having some problems on execute a program at the controller start an init the variables only once.


    For example:


    Program main


    VAR

    i : INTERGER


    ROUTINE Init

    BEGIN

    i=0

    END Init



    ROUTINE Program

    BEGIN

    i=i+1

    END_Program


    BEGIN

    Init

    REPEAT

    abort_=FLG[555]

    Program

    DELAY(1000)

    UNTIL abort_

    END main


    I put [Main] in HOT START and COLD START Autoexec program but every cold or hot start i restart to 0 even with the '" return to top of program" = FALSE


    May be there is another way to do what I need?


    Thanks

    Here is my Karel code:


    IF Day <> $SYS_TIME.$DAY THEN


    IF $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME > 480 THEN

    TIMER_DAY[i] = $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME - 480

    ELSE

    TIMER_DAY[i] = 0

    ENDIF


    Memo_SRV_TIME= $SYSTEM_TIME[1].SRV_TOT

    i=i+1

    ELSE

    Day = $SYS_TIME.$DAY

    ENDIF





    And this is the error:



    C:\Users\NMARILLE\Documents\My Workcells\Arvis2\loc_timer.kl(45)

    45 IF $SYSTEM_TIME[1].SRV_TOT - Memo_SRV_TIME > 480 THEN

    ^ ERROR

    Id must be defined before this use. Id: $SYSTEM_TIME


    thanks

    Hi everybody,

    I am looking for a way to count the time when the servos of my robot are on. I found the $SYSTEM_TIME[1].SRV_TOT variable that would do the job but I can't access this variable with my Karel program. I am on a R30iB mini plus controler.


    Thanks!


    :smiling_face:

Advertising from our partners