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

Log

Members
  • Content Count

    41
  • Joined

  • Last visited

  • Days Won

    14

Posts posted by Log

  1. Connect it through the adapter and type in terminal this command components reactor -l, so you will get a list of methods.

    for example, to obtain the temperature value, you can do this:  print(component.reactor.getHeat()/component.reactor.getMaxHeat())

    lTtilb3.png

  2. Only this way:

    robot = component.proxy(component.list("robot")())
    rs = component.proxy(component.list("redstone")())
    function getBatteryPercent()
      return computer.energy() * 100 / computer.maxEnergy()
    end
    function wait(seconds)
      local begin = os.time()
      repeat
        computer.pullSignal(0.05)
      until os.time() - begin >= seconds
    end
    while true do
      robot.turn(true)
      robot.turn(true)
      robot.move(1)
      while not robot.compare(3) do
        robot.move(3)
        robot.turn(false)
        robot.swing(3)
        robot.turn(true)
        robot.turn(true)
        robot.swing(3)
        robot.turn(false)
      end
      robot.turn(true)
      robot.move(0)
      robot.turn(true)
      while true do
        if rs.getInput(1) > 0 then
          if getBatteryPercent() < 20 then
            rs.setOutput(0, 15)
          else
            rs.setOutput(0, 0)
          end
          wait(60)
        else
          robot.move(3)
        end
      end
    end
    
  3. Simple:

    local debug = require("component").debug
    local cmd
    
    while true do
      io.write('Enter command: ')
      cmd = io.read()
      print(debug.runCommand(cmd)..'\n')
    end
    

    Very simple:

    /# lua

    =component.debug.runCommand("say hello!")

  4. 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

     

    lMMp1Ke.png

  5. Why the pixels are not square?

    local component = require('component')
    local event = require('event')
    local gpu = component.gpu
    local color = 0xFF0000
    local tSize = {gpu.getResolution()}
    
    local function clear()
      gpu.setBackground(0x000000)
      gpu.setForeground(0x000000)
      gpu.fill(1, 1, tSize[1], tSize[2], ' ')
    end
    
    clear()
    
    while 1 do
      local e = {event.pull()}
      if e[1] == 'touch' or e[1] == 'drag' or e[1] == 'drop' then
        local pixel = {gpu.get(e[3], e[4])}
        if e[5] == 0 then
          gpu.setForeground(color)
          gpu.setBackground(pixel[3])
          gpu.set(e[3], e[4], 'â–„')
        elseif e[5] == 1 then
          gpu.setForeground(pixel[2])
          gpu.setBackground(color)
          gpu.set(e[3], e[4], 'â–„')  
        end
      end
    end
    

    Just an idea

×
×
  • Create New...

Important Information

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