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

[Question]Reactor Monitor Readout

Started by Godleydemon, 17 October 2012 - 12:07 AM
Godleydemon #1
Posted 17 October 2012 - 02:07 AM
Ok so I was wanting to do this with computer craft. I have a 2 x 3 monitor display (this can be increased if need be) See picture attached below.

Now what I'm trying to do is by using computer craft sensors to read the temperature, current eu output, ect. I have got this part figured out and setup and that a sensor controller already hooked up to the right computer. I also already have the IC2 Sensor setup below the reactor and its reading pretty good.

My problem is I don't know how to write programs very well with computer craft. I need a program that can basically read from the sensor controller and then output this data onto the large monitor in a nice format for easy reading. I would also need it to update itself maybe every 5 seconds or so. I've been looking everywhere for something similiar to what I'm asking for and I just keep scratching my head at a lot of it. Any help would be appreciated. I was a complete Tekkit noobie before starting out on this server with a few friends of mine. We've been learning pretty much together on how to play tekkit and its been a lot of fun. But I think this is starting to go over my head programming something like this. I would have thought it would have been easy, I guess I was completely mistaken, lol.

for those wondering what I"m trying to shoot for, something a little like this


in closing, any computer craft programmers want to help me out here?

—————————–
This is a repost from the programs forums. The reason I'm posting it here is because I didn't realize there was a pro forum until now. Sorry about that, lol. But hopefully this is where this belongs now.
Godleydemon #2
Posted 17 October 2012 - 02:17 AM
After giving it a little though I have two seperate monitor screens on the left and right. The left will control the water flow from the cieling and onto the reactor itself. The monitor readout will say something like

Water Flow: Off/On
Doors: Open/Closed

The right will have pertinent EU information for storage display.

EU Output: 150
Stored EU: 1000000

This could significantly decrease the screen size I would need on the main monitor but unfortunately would mean I'm going to be running more than one program and sensor controller. The next problem I have atm is I haven't figured out how to get programs to display onto the monitor. I played around with a sensor gui program last night and even with the largest display possible I still couldn't get it to display. Maybe I'm just doing something completely wrong here. I don't even know anything about using the floppy disks for gods sake, lol.
Godleydemon #3
Posted 17 October 2012 - 03:32 AM
So now I have an even stranger problem, I tried to use this code to experiment with monitors and getting them to display text and how it works. But for some reason its not showing anything on the monitor thats right next to the computer.

Setup
Computer – Monitor

Am I just doing something weird here 0.o?


monitor = peripheral.wrap("right") -- Moved the initialization out of the loop
monitor.setTextScale(1)
repeat 
  term.clear()  -- Moved to start of loop to handle case where cursor is somewhere weird to begin with
  term.setCursorPos( 1, 1 )
  local nTime = os.time()
  print( "The time is "..textutils.formatTime( nTime, false ) )
  if nTime < 18 and nTime > 6 then
	    print("Have a good day!")
  else
	    print("Have a good night!")
  end
  sleep(1)
until nil
remiX #4
Posted 17 October 2012 - 06:11 AM
Well, you're not printing to the monitor.

Try
monitor.print(...)

Edit: Naw, that doesn't work :D/>/>

Try using shell.run
ChunLing #5
Posted 17 October 2012 - 07:35 AM
You need to use the monitor methods, described here.
Lyqyd #6
Posted 17 October 2012 - 03:45 PM
You didn't use term.redirect(). print() outputs to the current term target, which you set with term.redirect.
ChunLing #7
Posted 17 October 2012 - 05:30 PM
Yes, term.redirect is also a valid way to do this. But given that you want to have a relatively static display with only specific elements being updated, the monitor methods provide functions that are specific to that task and more efficient than updating the entire screen. That will also leave the terminal screen itself free to display its "normal" output while running your program.
Lyqyd #8
Posted 17 October 2012 - 08:03 PM
Yes, term.redirect is also a valid way to do this. But given that you want to have a relatively static display with only specific elements being updated, the monitor methods provide functions that are specific to that task and more efficient than updating the entire screen. That will also leave the terminal screen itself free to display its "normal" output while running your program.

These things would only be drawbacks to incorrect usage of terminal redirection, or are not actual issues at all. Both are quite valid methods for writing to the monitor.
ChunLing #9
Posted 17 October 2012 - 08:34 PM
Hmm…and term.redirect is probably a faster way to adapt what he's already got.