Jump to content




[Question]: I/O peripherals


  • You cannot reply to this topic
3 replies to this topic

#1 Monsieurlefou

  • New Members
  • 2 posts

Posted 13 March 2013 - 10:44 AM

Hi,

I discoverd computercraft via Tekkit and I love it! I got a question and can't find the answer too it. As I said, I'm using computercraft via the Tekkit modpack, so if I'm not mistaken it is version 1.3.

My question: as far as I can tell the basis computer unit only got 3 I/O (inputs/outputs): left, right and back. Is there a way to increase the amount of I/O's, while still using tekkit?
I'm sorry if the answer tot this question is obivious, but I had no succes finding the answer.

Thanks in advance,
Monsieurlefou

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 13 March 2013 - 03:24 PM

Split into new topic.

Available sides are: top, bottom, front, back, left, right.

#3 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 13 March 2013 - 04:19 PM

The best way to deal with I/O sides is by using the table provided by rs.getSides(). Here's an example:

local modem = false
local function attachToModem()
  for i,v in pairs(rs.getSides()) do
	if peripheral.getType(v) == "modem" then
	  modem = peripheral.wrap(v)
          return true
	end
  end
  return false
end

attachToModem()

With the above code, I will never have to worry about defining a peripheral in a hardcoded manner. It will cycle through all the available peripheral sides (which are the same as rednet sides) and check if it is the type of peripheral I want to attach to. If so, then it will attach automatically.

I believe that there is a "wireless peripherals" peripheral in the forums if you take a look there, which could extend the number of I/O you have. There is also a wired peripherals mod that does the same thing.

#4 Monsieurlefou

  • New Members
  • 2 posts

Posted 13 March 2013 - 10:58 PM

Thanks, this is all very helpfull!

I started increasing I/O's with logic circuits (AND, NOT), but your method will save me a lot of time, effort, recourses and space. Also didn't know about all sides being able to input/output.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users