Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Sign in to follow this  
Pigpork

How to use redstone cards

Question

Hi, I'm new and I need some help on opencomputers.

Can anyone post or make a tutorial on redstone cards? Because I cant find any tutorials on redstone cards which aren't outdated

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello! In order to use a redstone card the first thing you need to do is require the component library and set up a variable for the redstone card, using the following code:

local component = require("component")
local redstone = component.redstone

You will then have access to the redstone component, documentation for which is here: http://ocdoc.cil.li/component:redstone

 

You may also want to require the sides API, the code to do so looks like this:

local sides = require("sides")

This will give you access to the sides API, which lets you say "sides.top" or "sides.bottom" when using the redstone card, something that is very handy.

 

Documentation for this API is here: http://ocdoc.cil.li/api:sides

 

Here is some example code using the redstone component and the sides API to help you get started

local component = require("component") --require component in order to use the component API
local sides = require("sides")
local redstone = component.redstone -- create the variable "redstone" (which is shorter than typing out component.redstone)

redstone.setOutput(sides.bottom, 15) -- Set the redstone output on the bottom of the computer to 15, the maximum for vanilla redstone

local strength = redstone.getInput(sides.top) -- Set the new local variable "strength" to the strength of the redstone signal on top of the computer case

print(strength)

Hope you found this post helpful!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.