simulace továrny

součísti:

robotická ruka

pás

displej

piezo reproduktor

zapojení:

B.0 : pás
B.1 - B.4 : ruka
B.5 : červené led
B.6 : displej
B.7 : žlutá led

C.1 : světelná závora
C.3 : senzor touch
C.7 : piezo reproduktor 

program:

start:

serout 6, N2400, ($FE,$01)

serout 6, N2400, ("dotknete se !")

touch C.3,b5 

if b5 < 250 then start 

serout 6, N2400, ($FE,$E9)

servo 2,50

servo 3,200

servo 4,100

posun:

serout 6, N2400, ($FE,$01)

serout 6, N2400, (#b0," ",#b5)

serout 6, N2400, ($FE,$C0)

serout 6, N2400, (#b1)

if pin1=1 then let b1=0 high 0 high 7 low 5 inc B0 if B0>240 then spad goto posun endif

let b0=0

inc B1

if b1>3 then zvedn

low 0

low 7

high 5

wait 1

servo 1,175

wait 1

servo 2,140

wait 1

servo 3,150

wait 1

servo 4,255

wait 1

servo 2,50

servo 3,200

wait 1

servo 1,105

wait 1

servo 2,130

wait 1

servo 3,155

wait 1

servo 4,100

wait 1

low 2

low 3

low 4

low 1

goto start

spad:

if pin1=0 then posun

low 2

low 3

low 4

low 1

low 0

serout 6, N2400, ($FE,$01)

serout 6, N2400, ("kostka spadla")

serout 6, N2400, ($FE,$C0)

serout 6, N2400, ("vrat ji na pas")

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 300

toggle 7

goto spad

zvedn:

low 2

low 3

low 4

low 1

low 0

let b1=0

serout 6, N2400, ($FE,$01)

serout 6, N2400, ("kostka nelze")

serout 6, N2400, ($FE,$C0)

serout 6, N2400, ("zvednout")

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 300

toggle 7

serout 6, N2400, ($FE,$01)

serout 6, N2400, ("odeber ji")

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 20

toggle 7

sound C.7,(100, 10)

pause 300

toggle 7

if pin1=1 then spad

goto zvedn

konec:

low 5

low 6

low 7

serout 6, N2400, ($FE,$E8)

goto konec