This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Xixili's profile picture

Chest redstone output

Started by Xixili, 19 April 2014 - 06:23 PM
Xixili #1
Posted 19 April 2014 - 08:23 PM
Hello everyone,

I have a little problem.

I have a chest that collects Near depleted uranium cells.

What I like to get is everytime a cell arrives in the chest a short redstone pulse comes off the chest.
Im only getting this working with a full chest or empty chest.

Im using a computer (doh) and a gate reader and the code I have so far is:


while true do
  m = peripheral.wrap("top")
  data = m.get()
  if data["Inventory Empty"] then
   rs.setOutput("left", true)
   sleep(3)
   rs.setOutput("left", false)
  end
  sleep(1)
end
RoD #2
Posted 19 April 2014 - 10:01 PM
Doesn't the trap chest triger a redstone output when a item is added? or is it only when the player opens the chest? And you can try to use a hppper :)/>
Xixili #3
Posted 19 April 2014 - 11:19 PM
Doesn't the trap chest triger a redstone output when a item is added? or is it only when the player opens the chest? And you can try to use a hppper :)/>
No other solutions?
RoD #4
Posted 20 April 2014 - 12:28 AM
Doesn't the trap chest triger a redstone output when a item is added? or is it only when the player opens the chest? And you can try to use a hppper :)/>
No other solutions?
I didng get if you are using a peripheral. But if you are not using there may be some that do that ( i dont use peripherals, so i don't know much about them ). If you are are planing to play only with cc then i think that there are no other options…
Xixili #5
Posted 20 April 2014 - 01:12 AM
A computer should pulse a redstone singal for 1 second when an item arrives in the chest.
RoD #6
Posted 20 April 2014 - 01:20 AM
i use:

redstone.setOutput("left", true)
instead of:

rs.setOutput("left", true)
But i dont think it makes any diference… Only if there's a bug…
Bomb Bloke #7
Posted 20 April 2014 - 02:18 AM
Since no events fire when items enter adjacent chests, if you specifically want to plonk a computer directly next to one and get redstone signals from there, I guess you'd need to devise a system whereby the computer reads the full contents of the chest into a table, then re-reads that content every now and then (according to a timer) while checking for differences. A bit of a hack job, but it could be done.

Since you're using a gate reader though, I'll assume you're using Buildcraft pipes to fill the chest, which is handy since my method would involve putting a gate in the pipe that outputs to the chest. Configure THAT to perform a redstone pulse when items go through it and forget about using ComputerCraft for this job.

If you don't like the duration, a vanilla repeater can be used to increase it somewhat, or a computer can be programmed to extend it.