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

Search the Community

Showing results for tags 'microcontroller'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Minecraft


GitHub


IRC


Fediverse ID


Location


Interests

Found 11 results

  1. I am currently working on a project using microcontrollers and need to be able to turn them on remotely using the setWakeMessage function though i seem to be doing something wrong. Microcontroller1: local modem = component.proxy(component.list("modem")()) modem.broadcast(1,"start") Microcontroller2: local modem = component.proxy(component.list("modem")()) modem.open(1) modem.setWakeMessage("start") Both of the microcontrollers have a tier 2 wireless network card and the one that is supposed to turn on (Microcontroller2) has of course been turned on previously so the port and the wake message should be set but it still doesn't turn on. Edit: If one of the devices is a computer and instead of a microcontroller it works perfectly fine. It just seems to not work when a microcontroller is sending the message AND a microcontroller is receiving the message.
  2. Hakz_Studioz

    Help

    I made a microcontroller program that works with computer craft, but it doesn’t work. Please help. The program is in pastebin.com/L2WBivB5 The error is: bad argument #1 (string expected, got nil). Please help! -Hakz Studioz
  3. Program and library for building GPS network. https://github.com/DOOBW/OC-GPS Download: wget https://raw.githubusercontent.com/DOOBW/OC-GPS/master/usr/bin/gps.lua /bin/gps.lua wget https://raw.githubusercontent.com/DOOBW/OC-GPS/master/usr/lib/gps.lua /lib/gps.lua The functionality is the same as in the ComputerCraft. Additional command "flash" allows to upload firmware to EEPROM. When the coordinates are precisely determined, when flashing the position of the microcontroller can be omitted - at the first start it will determine its position from neighboring satellites and save on EEPROM. GPS network startup example.
  4. i have made some code to play around with the modem stuff but for some reason the modem_message event always returns 0 also im am running one of the scripts on a microcontroller and i am running minecraft version 1.7.10 code of the microcontroller: local rs = component.proxy(component.list("redstone")()) local modem = component.proxy(component.list(modem)()) local identity = 1 a ={} d = "id:" f = tostring(identity) a[1] = d a[2] = f modem.broadcast(1234, "id:1 is online") while true do computer.pullSignal(0.5) end code of the not microcontroller: local component = require('component') local event = require('event') local modem = component.modem modem.open(1234) while true do local _, _, from, port, message = event.pull("modem_message") print(message) os.sleep(0.1) end obviously both are connected with wires and the file with the modem.open is executed befor starting the microcontroller
  5. Ok!!! So I have been working my butt off to get this to work. It is a wirelessly controlled microcontroller! And if you have a look at the code you might notice that it DOES NOT HAVE SPACING! I RAN OUT OF EEPROM SPACE OK!!! DO NOT COMMENT ABOUT THAT!!! Ok... This took a long time to work all this out but I think its great! FEATURES: Network Cards (not sure about computronics spoofing card though) Wireless Network Cards (both tiers) Linked Cards (my personal favorite) Names Passwords Ports SUPER EASY!!! USES: Remote Door Control Remote Redstone Control Remote ANYTHING WITH A MICROCONTROLLER Control TUTORIAL: Step One - Set up a pc that can edit EEPROMs (I use the flash command) Step Two - Download the Pastebin file using this command: pastebin get BrhTgvET RCMICROBIOS Step There - Upload it to the EEPROM. I use this command: flash RCMICROBIOS Step Four - Make a Microcontroller: Must include these things 1. A Modem of any kind 2. A sign upgrade 3. The EEPROM that you just made Step Five - Place down the Microcontroller where you want then fill out a sign on ITS FACE like this: LINE1 = name of microcontroller LINE2 = password LINE3 = port (nothing if using a linked card) EXAMPLES SENDS: A. component.modem.broadcast(217,"DOOR A", "password123", "component.proxy(component.list(\"redstone\")()).setOutput(2,1)") --Yes you most call components this way on a EEPROM B. component.tunnel.send("DOOR A", "password123", "local R = component.proxy(component.list(\"redstone\")())") --But you can just save them as variables C. component.modem.broadcast(217,"DOOR A","password123","return R.getInput(2)") --it can even return data to you in a SERIALIZED packet! YAY! LINKS: https://pastebin.com/BrhTgvET And that's about it. If you have any suggestions just say so! I'll try to make this as great as possible!
  6. mc also means microcontroller if you didn't know. Hello there, were you banging your head against a wall while you tried to automate Draconic Evolution's Fusion Crafting? Well, I was about to, but I realized OpenComputers has got my back(like always). So, I wrote this simple program that runs on a mc to do this job properly for me. I made it with Applied Energestics auto-crafting in mind and I've got a mod that implements transporting pipes that can round-robin one item at a time(EnderIO) in the modpack I play on, so if you want it to run based on something else, you might need to tweak this a lot. It's also kinda smart, it can tell if the recipe is a normal in-out crafting one, or it it's upgrading a tool, so it is going to route items accordingly. Pros: easy to setup reliable has an "upgrade" mode that will make the fusion core self-feed so you can upgrade easily all the cons can be overcome if you modify the code to your needs. Cons: it relies on something else to transfer items into the injectors one by one. "upgrade" mode is not fully automatic, you need to manually place your tool inside the core and to place your required upgrade key inside any injector, and to take them out after you are done(still automatic if you are doing the same upgrade) there is room for improving the energy consumption for the mc, however do you really mind extra ~1RF/t after you've got a fusion crafting system? requires a dummy item(I use a stone block, and it doesn't care about NBT) it expects all the ingredients of only ONE crafting session to be pumped all at once(in a single tick), and the ingredient provider must wait for the crafting to finish, which an AE interface does if properly configured. The setup is simple: first, you build something like I did in the picture above(note: you will also need power, and what's between the interface and mc is a dropper that is facing the interface, you will find out why soon). It doesn't have to look same, just act the same. In fact, not even the sides you are going to hook it up matter, you will just have to configure the code accordingly. Then, interface's blocking mode must be enabled(top-left button in it's GUI, set to "do not push crafting items if inventory contains items"). The top-most extractor(in the picture) must be set to round-robin and it must pipe one item at a time(for EnderIO, enable round robin and place a downgrade). To make the mc you need a tier 1 case, CPU , RAM(just 1), redstone card and one transposer, assemble and voila, you are done with that part. The last thing you have to do is to flash an eeprom with the provided code(I assume you know how to do it, look it up), but not before you tweak it a little. If you look at the second paragraph of the code there are some variables that you must define. Those are the sides the mc connects to, and "foo" is the code name of the dummy item I talked about and you must provide, I used stone, which is "minecraft:stone", as you can see, but you can change it to your desire. The other variables' value must be changed to numbers that represent cardinal directions(see the aliases on the sides API to know which number to input, it must be a NUMBER, not "sides.north" or things like that, the code doesn't have the actual side API in it). An exception is matr, which indicates the RELATIVE direction of the side the dropper is adjacent to, and depends on the direction your mc is facing(due to the fact the redstone card works using relative directions while the transposer is using absolute ones). If your mc is facing north, or the actual side is top or bottom, the number is same as mat's, otherwise you just look at the sides API again, but this time at the relative directions. t = component.proxy(component.list("trans")()) r = component.proxy(component.list("redstone")()) mat = materials aka ingredients corein = core input coreout = core output inj = injectors' input matr= materials redstone side foo = "minecraft:stone" --dummy item function wait(side) while t.getSlotStackSize(side,1)==0 do computer.pullSignal(0.05) end end --you can change 0.05 to something bigger to save more power but decrease sensitivity function check(sl) x = t.getStackInSlot(mat,sl).name end function isntfoo(slot) if pcall(check, slot) == false then return false end if x == foo then return false end return true end computer.beep(420,0.1) while true do wait(mat) if isntfoo(1) then t.transferItem(mat,corein,64,1,1) d = mat else d = corein end i=2 while isntfoo(i) do t.transferItem(mat,inj,64,i,i) i=i+1 end wait(coreout) if d == mat then i= 1 + t.getSlotStackSize(coreout,1) else i=1 end t.transferItem(coreout,d,64,1,2) for j=1,i do r.setOutput(matr,1) r.setOutput(matr,0) end end For example: mat = 1 corein = 2 coreout = 3 inj = 4 matr= 1 --my mc is facing north foo = "minecraft:stone" The redstone card's purpose is to send the items back to the network via dropper. When you turn the mc on it should greet you with just one discreet warm beep to indicate it is on and working. You are almost done, you just need to define the recipes. Important note is that the order in which items come matter. In case of AE, to make a proper recipe pattern you must put the items in it's 3x3 grid in order from top-left to bottom-right. For normal crafting, first slot must be the item going to the core, followed by injector's ingredients, and last comes just one dummy item that you have chosen. After it is done crafting the output and the dummy item is returned. For the "upgrade" mode, you must place one dummy item in the FIRST slot, followed by the ingredients(excluding upgrade keys!). After it is done crafting only the dummy item is returned. Again, note that before upgrading you must place the tool inside the core and the key(if needed) inside any injector, and after you are done you must take those out. Hope you understood how this works, you will do that only if you went along and read everything(or reverse-engineered the code), I did not explain like you were 5, because after all we are on a forum for geeks. If you have any question(besides what's an "mc", how to craft one, and how to flash an eeprom), suggestion(if feasible) or even an improvement, don't be afraid to post. Good luck!
  7. 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)
  8. So, basically I'm trying to do this thing where I have a microcontroller and I want it always receiving, and when it receives a certain message, I want it to output redstone. I've got all the right components, and it doesn't crash on boot, but when it receives a message, it crashes. The code is simple, and yes I'm doing the component.proxy() thing. Full code: local modem = component.proxy(component.list("modem")()) local redstone = component.proxy(component.list("redstone")()) modem.open(123) local name, _, from, port, _, message = computer.pullSignal("modem_message") if message == "hi" then redstone.setOutput(1,10) else redstone.setOutput(1,0) end
  9. While I was in boredom, I made a simple microcontroller program. microcont.lua local rs = component.proxy(component.list("redstone")()) while true do if rs.getInput(3) > 0 then computer.beep() end computer.pullSignal() end When the microcontroller receives a redstone signal from it's front, it beeps. Took me some time to figure out how to make an actual program for microcontrollers that doesn't error out after a few seconds. (also, this is my first topic!)
  10. Requirements: microcontroller with debug card and wi-fi card. Need install this firmware: pastebin get PX0k2kb8 cube The control is via a wireless card with standard notation UDFBLR, to invert the command, it is necessary to add an apostrophe. Ðdditional commands: С - reset to the initial state S - random shuffle
  11. So I built a drone, and finally managed to get a custom bios running for test purposes. The problem is that I can't seem to get it to sleep (so that a move command can finish). Each time I try, I get the following error: bios:6: attempt to call field 'sleep' (a nil value) The code I'm using is: --local os = require("os") local drone = component.proxy(component.list("drone")()) while true do drone.move(1,1,1) --print("zomgwtf") os.sleep(1) drone.move(-1,-1,-1) end (The print and require statements were leftovers of various debugging attempts.) There's got to be a way to sleep right? Drones are going to need to wait sometimes, but there doesn't seem to be any function to do that. I know the sleep command works, since os.sleep works on a computer when placed in a script, and thus there's no live lua interpreter magic going on when calling sleep. What's up here? Edit: Version info: Minecraft 1.7.10 Forge: 10.13.2.1240 OpenComputers:1.5.8.17
×
×
  • Create New...

Important Information

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