意圖是,X0到X3都是電燈,每個(gè)對(duì)應(yīng)一個(gè)開(kāi)關(guān),我希望當(dāng)我按一下開(kāi)關(guān)時(shí),燈會(huì)亮;再按一下,燈滅了。而X4是一個(gè)電風(fēng)扇,和燈的功用是一樣的。X5和X6是兩個(gè)馬達(dá),也各自對(duì)應(yīng)一個(gè)開(kāi)關(guān),我希望我按一下開(kāi)關(guān),馬達(dá)會(huì)開(kāi)始轉(zhuǎn)動(dòng)5秒鐘,再停下來(lái)。下面是編程:
LD X0
OUT Y0
LD X1
OUT Y1
LD X2
OUT Y2
LD X3
OUT Y3
LD X4
OUT Y4
LD X5
OUT T0 K50
ANI T0
OUT Y5
LD X6
OUT T1 K50
ANI T1
OUT Y6
END