Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- guardamos la pantalla del ordenador, el monitor y el flux gate
- c = term.current(); -- computer
- m = peripheral.wrap("top") -- monitor
- f = peripheral.wrap("flux_gate_2") -- flux gate
- -- iniciamos el wifi
- rednet.open( "right" )
- -- limpiamos la pantalla
- function limpiarPantalla()
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextScale(1)
- m.setCursorPos(2,2)
- m.write('Estado: ')
- end
- while true do
- -- esperamos que llegue un mensaje
- senderId, message, protocol = rednet.receive(1)
- if message == 'on' then
- -- si llega el mensaje de encender
- f.setSignalLowFlow(100)
- limpiarPantalla()
- m.blit('ON', 'ff', 'dd')
- elseif message == 'off' then
- -- si llega el mensaje de apagar
- f.setSignalLowFlow(0)
- limpiarPantalla()
- m.blit('OFF', 'fff', 'eee')
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement