Computercraft help

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Will Stead

New Member
Jul 29, 2019
24
0
0
Does anyone know how to get an advanced computer to send a redstone signal when an energy cell from thermal expansion has a certain energy level then stop sending when it hits another level and then only resend the signal when it re-hits the original level?
for example send the signal when power level is at 40,000,000 and stop when power level is at 100,000. I don't know how to get it so that it sends at 40,000,000 and stop at 100,000 then doesnt restart untill it hits 40,000,000 again. I don't want it to send the signal when its charging. Anyone got any idea?
Thanks
 

wolfsilver00

New Member
Jul 29, 2019
752
0
0
ComputerCraft is a mod that allows you to learn, so using a code given to you is not a good idea, but here:

http://pastebin.com/1fUiLd0e

You should explore that code and learn how it works, then you will be able to make your own without a problem :)
 

Platinawolf

New Member
Jul 29, 2019
147
0
0
Lets see...

if power is over 400000 stop redstone singal
if power is less than 100000 send redstone signal?


The last conditional is strange,,, Only send a redstone pulse when it reaches the different levels? I'm assuming that part isn't needed.
Code:
cellDirection = "left"
redstoneDirection = "top"
energyStopLevel = 40000000
energyStartLevel = 100000
redstoneCell = peripheral.wrap(cellDirection)

while true do
redstoneCell.energy = redstoneCell.getEnergyStored("RF")
if redstoneCell.energy >energyStopLevel then
    rs.setOutput(redstoneDirection,false)
else if (redstoneCell.energy < energyStartLevel) then
    rs.setOutput(redstoneDirection,true)
end
sleep(1)
end
 

Will Stead

New Member
Jul 29, 2019
24
0
0
What I meant by the last conditional is that it doesnt send the redstone signal until it hits 40,000,000 to prevent the cell outputting while charging. But I wasnt sure if that was possible. Thankyou for the code :)
 

Platinawolf

New Member
Jul 29, 2019
147
0
0
No problem. :) Not sure exactly what you wanted but thats a basic frame-work for you to start working on :)
 

Will Stead

New Member
Jul 29, 2019
24
0
0
I wanted it so an energy cell could send energy through a tesseract to a quarry but only when the power hit 40,000,000 on the cell
i then wanted it to stop sending when the power hits 100,000
and restart again once it had charged back to 40,000,000