I'm trying to create a 2s ON 1s OFF signal that I can use for blinking some lights. I wrote the following code and am running in BGLogic.
1: IF ($FAST_CLOCK MOD (3000)<2900),F[30:2s ON 1s OFF]=PULSE,2.0sec ;
2: R[10]=$FAST_CLOCK ;
3: R[11]=R[10] MOD 3000 ;
F[30] is only pulsing for about half of the time commanded. I.e, a 2.0sec pulse goes high for 1 second, but if I set it to 4.0sec, I get a 2 second pulse. Why? This is in roboguide, on a R30iA (v7.7).
I added lines 2 and 3 to help debug and to make sure that $FAST_CLOCK works how I thought it did, and it does... in the virtual world.
To check and see if the issue is just in Roboguide, I put the exact same program on an RJ3iB I have out in the plant. On that robot, the pulse is 2 seconds as expected, but R[11] takes 12 seconds to count to 3000.
I have a working solution (changing the pulse to 4seconds), but I'd really like to understand what's going on with this code and why $FAST_CLOCK on the real robot is running so slow.