Posted 27 June 2017 - 11:50 AM
Hello World,
at the moment i try to write a program that controll a door, the door is build with remain in motion. (Pics)
ok heres the code and under the code is all what is in and whats not working, while my brain is on fire.
at this moment the programm works on this, but i want some things that i cant do, while i dont now how.
The First thing is, that i cant reset the ligthblue cable, it should reset when the for loop is by 5 i tryed it so:
but it doesnt work.
The next think is
you see its not really computercraft, some thinks are other, but i want to try it on opencomputers.
and sorry for the bad language, i hope you can help me, if questions you can ask everytime.
The files are 8KB to big so i uploaded here
https://picload.org/....43.58.png.html
https://picload.org/....44.03.png.html
https://picload.org/....44.12.png.html
https://picload.org/....44.20.png.html
https://picload.org/....49.02.png.html
https://picload.org/....49.11.png.html
https://picload.org/....49.22.png.html
at the moment i try to write a program that controll a door, the door is build with remain in motion. (Pics)
ok heres the code and under the code is all what is in and whats not working, while my brain is on fire.
local component = require("component")
local sides = require("sides")
local colors = require("colors")
local redstone = component.redstone
local computer = require("computer")
oeffner = redstone.getBundledInput(sides.back, colors.magenta)
yellow = redstone.getBundledInput(sides.back, colors.yellow)
lime = redstone.getBundledInput(sides.back, colors.lime)
print("Willkommen im Türkontrollmodus")
if(yellow == 241 and lime == 243) then
print("Tür ist Zurzeit geschlossen")
elseif (yellow < 241 and lime < 243) then
print("Tür ist zurzeit geöffnet")
else
print("Tür steht in einem unbekannten Zustand")
end
print("Bitte warten, die Türsteuerung wird geladen.")
print("")
print("")
os.sleep(2)
print("Willkommen bei der Türsteuerung")
print("Bitte eingabe erfassen zum Tor öffnen(1) oder schließen(2)")
eingabe = io.read()
while not tonumber(eingabe) do
print("keine Nummer")
print("Bitte eine Ziffer von 0-9 Eingeben")
eingabe = io.read()
end
if (eingabe == "1" and yellow == 241 and lime == 243) then
print("Tür wird geöffnet")
redstone.setBundledOutput(sides.back, colors.lightblue, 255)
for i=1,5 do
redstone.setBundledOutput(sides.back, colors.orange, 255)
os.sleep(0.1)
redstone.setBundledOutput(sides.back, colors.orange, 0)
os.sleep(1)
end
elseif (eingabe == "2" and yellow < 241 and lime < 243) then
print("Tür wird geschlossen")
redstone.setBundledOutput(sides.back, colors.lightblue, 255)
for i=1,5 do
redstone.setBundledOutput(sides.back, colors.white, 255)
os.sleep(0.1)
redstone.setBundledOutput(sides.back, colors.white, 0)
os.sleep(1)
end
else
print("Eingabe nicht möglich, Nummer nicht verwendet, oder Tor bereits geöffnet/geschlossen")
print("Bitte erneut versuchen")
os.sleep(2)
computer.shutdown(true)
end
at this moment the programm works on this, but i want some things that i cant do, while i dont now how.
The First thing is, that i cant reset the ligthblue cable, it should reset when the for loop is by 5 i tryed it so:
if (eingabe == "1" and yellow == 241 and lime == 243) then
print("Tür wird geöffnet")
redstone.setBundledOutput(sides.back, colors.lightblue, 255)
for i=1,5 do
redstone.setBundledOutput(sides.back, colors.orange, 255)
os.sleep(0.1)
redstone.setBundledOutput(sides.back, colors.orange, 0)
if (i == "5") then
redstone.setBundledOutput(sides.back, colors.lightblue, 0)
end
os.sleep(1)
end
but it doesnt work.
The next think is
eingabe = io.read()
i want to kill the io.read if the input oeffner is true or has a signal from 230.you see its not really computercraft, some thinks are other, but i want to try it on opencomputers.
and sorry for the bad language, i hope you can help me, if questions you can ask everytime.
The files are 8KB to big so i uploaded here
https://picload.org/....43.58.png.html
https://picload.org/....44.03.png.html
https://picload.org/....44.12.png.html
https://picload.org/....44.20.png.html
https://picload.org/....49.02.png.html
https://picload.org/....49.11.png.html
https://picload.org/....49.22.png.html
Edited on 27 June 2017 - 09:51 AM