Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7 for MC 1.7.10, 1.8.9, 1.9.4, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

Forums

  1. OpenComputers

    1. Announcements

      OpenComputers official announcements.

      117
      posts
    2. Feedback

      Tell us what you think.

      317
      posts
    3. IRC

      #OC channel discussion
      irc.esper.net #oc

      26
      posts
  2. Code Central

    1. Support

      Ask for support from the OpenComputers community

      2683
      posts
    2. Showcase

      Showcase what you have created for OC. No 'malware' or other junk!

      1614
      posts
    3. Tutorials

      Help other users out. Please no 'false tutorials'

      99
      posts
  3. Addons & More

    1. Addons Mods

      Show off your OC addons mods

      198
      posts
    2. Architectures

      Discussions for Architectures

      166
      posts
    3. OpenEngineering Task Force

      Discussion board for the OETF documents

      53
      posts
  4. General

    1. Lounge

      Just lounge around or have an open discussion.

      290
      posts
    2. Forum Games

      Fight boredom!

      61
      posts
    3. Showcase

      Show off your creations! (not for your programs)

      122
      posts
    4. Servers

      A place to advertise your servers

      133
      posts
  5. Archives

    1. Public Archives

      OpenComputers public archive forum

      8
      posts
  • Topics

  • Posts

    • local rs = component.proxy(component.list("redstone")()) local ceiling = 14 --/15 local floor = 1 local intervalSeconds = 10 local capSide = 4 -- http://ocdoc.cil.li/api:sides local rsLevel = 0 local capLevel = 0 function sleep(timeout) local deadline = computer.uptime() + (timeout or 0) repeat computer.pullSignal(0) until computer.uptime() >= deadline end while true do capLevel = rs.getComparatorInput(capSide) if capLevel >= ceiling then rsLevel = 1 elseif capLevel <= floor then rsLevel = 0 end rs.setOutput(capSide, rsLevel) -- debug stuff rs.setOutput(3, rsLevel) rs.setOutput(5, capLevel) rs.setOutput(2, 1) sleep(1) rs.setOutput(2, 0) -- end debug sleep(intervalSeconds) end Very simple microcontroller program (though as it is my first, it took me a while to figure out how to make it work considering the documentation on microcontrollers is not very good for newbies). Measures the comparator level of an adjacent block (I created it to measure the energy stored in an enderIO capacitor), emits a signal back if the comparator signal is full strength, stops emitting if it is at 0 (or any other configured values). This was made to manage an energy storage system, so that our reactor would not be running all the time at low levels, would not be stopping and starting in tiny bursts, but rather would have larger cycles more infrequently. https://pastebin.com/NucrVHkm   The lines between the comments about debugging can be safely removed, but I've left them in case they are in any way educational for someone else. I had a lot of trouble finding example code for microcontrollers, so i figured I'd post this one in case it's helpful to someone else. One thing that tripped me up for a little while was figuring out how to make the program sleep for a while since there is no sleep method available in a microcontroller. I had found this page: http://lua-users.org/wiki/SleepFunction, and tried several of the functions there but each gave me some kind of error after a little while. I ended up copying the sleep function from openOS's library files, and modifying it a little bit... I'm using computer.pullSignal() to take up time, though i don't entirely know yet what this function does i do recognize that it stalls for a little bit so it works well enough for my sleep function's needs. But yeah, for any newbies who may see this in the future, this page http://ocdoc.cil.li/tutorial:custom_oses and scouring openOS's libraries https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/resources/assets/opencomputers/loot/openos/boot was what ended up helping, as well as a german video sangar made (though i don't speak german)
    • I dig it mang. Nice job, this is really cool  
    • Twire (Testing Wire) is a small and simple unit testing API made for running automated tests, this is useful if you're in the need of testing every time if your new added features, or the old ones keep going as intended. The repository: https://github.com/sigmasoldi3r/oc-twire You may ask, why a testing suite? The reason behind making a testing suite is because I was tired of making random test.lua files that included few prints to check if all was going OK, so this makes this process much more easy to understand, if something fails and easy to see that everything is going as expected. In fact, I was also motivated by the idea of making in a future test runners like in other programming languages and environments is done. Installation To install the version 1.0.0 which is the current beta release, just paste this code in your shell with the insert key: (Of course you'll need an internet card, and this is intended to run with a tier-3 GPU and screen) Press enter and the library will be installed. If this topic gets outdated any time, you can check the repository (Look at the top) to see if there are new releases, updates or issues solved. If you have any issue or proposal you can post them at the repository issue tracker You're welcome in contributing at any time! Usage In the readme you'll find a simple usage example, I'll give you a brief explanation here: With the function describe you tell what you're doing or about to test, the second argument is the function inside the test. With the function it you describe what it should do, then the second argument (again) is the function that will be tested for failed assertions. Inside 'it', you assert conditions with the assert table of twire, like assert.equal(5, 6); which will result in a failed test because 5 == 6 will never be true (I hope so).
    • Hi. I can make a mistakes, because I'm from Ukraine. Write a code, with which the visitor of the store will be able to write a review about the store, and  only i can read it. Guest book so-called .. My mail, if u have a question: Email removed by moderator
  • Popular Contributors

×