pin.mode 25, input
interrupt 25, apitar_setor1
pin.mode 26, input
interrupt 26, apitar_setor2
pin.mode 34, input
interrupt 34, apitar_setor3
pin.mode 35, input
interrupt 35, apitar_setor4
IR.INIT 13, 12
ONINFRARED irReceived
apita_setor1 = 0
apita_setor2 = 0
apita_setor3 = 0
apita_setor4 = 0
setor1_on = 0
setor2_on = 0
setor3_on = 0
setor4_on = 0
TFT.FILL TFT.RGB(255, 201, 14)
TFT.LINE 120, 0, 120, 320, TFT.COLOR(WHITE)
TFT.LINE 0, 160, 240, 160, TFT.COLOR(WHITE)
while 1=1
if (setor1_on = 1) THEN
TFT.RECT 0, 0, 120, 159, TFT.RGB(0, 255, 0), 1
if (apita_setor1 = 1) THEN
TFT.RECT 0, 0, 120, 159, TFT.RGB(255,0,0), 1
PAUSE 1000
apita_setor1 = 0
endif
endif
if (setor2_on = 1) THEN
TFT.RECT 121, 0, 120, 159, TFT.RGB(0, 255, 0), 1
if (apita_setor2 = 1) THEN
TFT.RECT 121, 0, 120, 159, TFT.RGB(255,0,0), 1
PAUSE 1000
apita_setor2 = 0
endif
endif
if (setor3_on = 1) THEN
TFT.RECT 0, 161, 120, 159, TFT.RGB(0, 255, 0), 1
if(apita_setor3 = 1) THEN
TFT.RECT 0, 161, 120, 159, TFT.RGB(255,0,0), 1
PAUSE 1000
apita_setor3 = 0
endif
endif
if (setor4_on = 1) THEN
TFT.RECT 121, 161, 120, 159, TFT.RGB(0,255, 0), 1
if(apita_setor4 = 1) THEN
TFT.RECT 121, 161, 120, 159, TFT.RGB(255,0,0), 1
PAUSE 1000
apita_setor4 = 0
endif
endif
pause 1000
wend
irReceived:
'1 = FF0CF3
IF IR.GET$ = "FF0CF3" THEN
PRINT "ligou o setor 1"
setor1_on = 1
ENDIF
'2 = FF18E7
IF IR.GET$ = "FF18E7" THEN
PRINT "ligou o setor 2"
setor2_on = 1
ENDIF
'3 = FF5EA1
IF IR.GET$ = "FF5EA1" THEN
PRINT "ligou o setor 3"
setor3_on = 1
ENDIF
'4 = FF08F7
IF IR.GET$ = "FF08F7" THEN
PRINT "ligou o setor 4"
setor4_on = 1
ENDIF
RETURN
apitar_setor1:
if pin(25) = 0 THEN return
apita_setor1 = 1
return
apitar_setor2:
if pin(26) = 0 THEN return
apita_setor2 = 1
return
apitar_setor3:
if pin(34) = 0 THEN return
apita_setor3 = 1
return
apitar_setor4:
if pin(35) = 0 THEN return
apita_setor4 = 1
return
END