當前位置:編程學習大全網 - 編程軟體 - 用mcgs怎麽編程紅綠燈循環的腳本程序

用mcgs怎麽編程紅綠燈循環的腳本程序

先把時間設定好,路上的車所行的距離,時間跟妳燈的時間匹配。下面這個是四輛車過紅綠燈的程序

if $Second<30 then

時間=$Second

ELSE

時間=$Second-30

ENDIF

if X<1200 then

x=x+50

else

x=0

endif

if 時間>=15 and 時間<=29 and X=500 THEN

X=X-50

ENDIF

if X1>-1200 then

x1=x1-25

else

x1=0

endif

if 時間>=15 and 時間<=29 and X1=-550 THEN

X1=X1+25

ENDIF

if Y<800 then

Y=Y+15

else

Y=0

endif

IF 時間<14 and 時間>=0 and Y=150 THEN

Y=Y-15

ENDIF

if Y1>-800 then

Y1=Y1-20

else

Y1=0

endif

IF 時間<14 and 時間>=0 and Y1=-260 THEN

Y1=Y1+20

ENDIF

  • 上一篇:廣州數控編程主要有什麽代碼!(詳細)
  • 下一篇:C語言中的百分號是什麽?
  • copyright 2024編程學習大全網