2 posts
Posted 05 January 2013 - 07:38 AM
Can someone help me write this program. I imagin it to be easy but I am very new to computer craft. I want help writing a program that detects if it gets a Redstone pulse. Whenever it gets a Redstone pulse I want it to show how many times it got one on the monitor located to the right.
57 posts
Posted 05 January 2013 - 07:48 AM
we will not code it for you, go check the wiki :
http://computercraft...i/Redstone_(API)
2005 posts
Posted 05 January 2013 - 10:02 AM
To be precise, the purpose of this forum is more to help you learn how to program rather than provide custom programs without effort on your part.
Most of the time, people will offer code, but it is expected that you are making an effort to understand how the code works so that you can maintain and modify it yourself. This is more in keeping with the spirit of this forum and with the overall spirit of the CC mod.
If you just want a program coded without having to understand it, then search through the Programs forum (and Turtle Programs, if you're looking for a turtle program, which this isn't). People post lots and lots of complete programs there.
Not all of them really work very well.
8543 posts
Posted 05 January 2013 - 11:19 AM
This one is pretty easy. We don't generally provide code, but since I'm bored on break:
local redState = {}
local mon = peripheral.wrap("right")
local pulseCount = 0
for _, side in ipairs(rs.getSides()) do
redState[side] = rs.getInput(side)
end
local function pulseReceived()
for _, side in ipairs(rs.getSides()) do
if redState[side] ~= rs.getInput(side) then
redState[side] = rs.getInput(side)
if not redState[side] then
return true
end
end
end
return false
end
while true do
os.pullEvent("redstone")
if pulseReceived() then
pulseCount = pulseCount + 1
mon.clear()
mon.setCursorPos(1,1)
mon.write(pulseCount)
end
end
2 posts
Posted 05 January 2013 - 11:58 AM
I know I have been looking though YouTube videos to try to learn it but it makes very little sence to me
604 posts
Location
Spring Hill, Fl
Posted 05 January 2013 - 01:11 PM
But youll learn eventully,like me.And maybe you should start with small stuff.Like password doors.Or like an To-Do list or something,then you could get to making stuff like calculaters,like me.