SHOW:
|
|
- or go back to the newest paste.
1 | local modem = peripheral.find("modem") | |
2 | local monitor = peripheral.wrap("front") | |
3 | ||
4 | monitor.clear() | |
5 | monitor.setCursorPos(1,1) | |
6 | monitor.setTextScale(0.5) | |
7 | - | repeat |
7 | + | |
8 | term.setCursorPos(1,1) | |
9 | - | while redstone.getAnalogInput("left") <= 8 |
9 | + | print("Running...") |
10 | - | do rs.setOutput("back",false) |
10 | + | |
11 | - | modem.transmit(3,4,"Feed Active") |
11 | + | function fuelFeed(side, mode, bgc, tc) |
12 | - | monitor.setBackgroundColor(colors.green) |
12 | + | rs.setOutput(side, true) |
13 | - | monitor.setCursorPos(8, 4) |
13 | + | modem.transmit(3,4,mode) |
14 | - | monitor.write("Automated Fuel Control") |
14 | + | monitor.setCursorPos(1,1) |
15 | - | print("Automated Fuel Control") |
15 | + | monitor.clear() |
16 | - | monitor.setCursorPos(8, 5) |
16 | + | monitor.setTextColor(tc) |
17 | - | monitor.write("-=-=-=-=-=-=-=-=-=-=-=") |
17 | + | monitor.setBackgroundColor(bgc) |
18 | - | print("-=-=-=-=-=-=-=-=-=-=-=-") |
18 | + | monitor.setCursorPos(8, 4) |
19 | - | monitor.setCursorPos(8, 6) |
19 | + | monitor.write("Automated Fuel Control") |
20 | - | monitor.write("Fuel Feed Active") |
20 | + | monitor.setCursorPos(8, 5) |
21 | - | print("Fuel Feed Active") |
21 | + | monitor.write("-=-=-=-=-=-=-=-=-=-=-=-") |
22 | - | sleep(1) |
22 | + | monitor.setCursorPos(8, 6) |
23 | monitor.write(mode) | |
24 | sleep(1) | |
25 | rs.setOutput(side, false) | |
26 | end | |
27 | ||
28 | function standBy(mode, bgc, tc) | |
29 | - | while rs.getAnalogInput("left") >= 9 |
29 | + | modem.transmit(3,4,mode) |
30 | - | do rs.setOutput("back",true) |
30 | + | monitor.setCursorPos(1,1) |
31 | - | modem.transmit(3,4,"Standby") |
31 | + | monitor.clear() |
32 | - | monitor.setBackgroundColor(colors.red) |
32 | + | monitor.setTextColor(tc) |
33 | - | monitor.setCursorPos(8, 4) |
33 | + | monitor.setBackgroundColor(bgc) |
34 | - | monitor.write("Automated Fuel Control") |
34 | + | monitor.setCursorPos(8, 4) |
35 | - | print("Automated Fuel Control") |
35 | + | monitor.write("Automated Fuel Control") |
36 | - | monitor.setCursorPos(8, 5) |
36 | + | monitor.setCursorPos(8, 5) |
37 | - | monitor.write("-=-=-=-=-=-=-=-=-=-=-=") |
37 | + | monitor.write("-=-=-=-=-=-=-=-=-=-=-=-") |
38 | - | print("-=-=-=-=-=-=-=-=-=-=-=-") |
38 | + | monitor.setCursorPos(8, 6) |
39 | - | monitor.setCursorPos(8, 6) |
39 | + | monitor.write(mode) |
40 | - | monitor.write("Fuel Feed Inactive") |
40 | + | |
41 | - | print("Fuel Feed Inactive") |
41 | + | |
42 | - | sleep(1) |
42 | + | while rs.getInput("front") == false |
43 | do | |
44 | ||
45 | local batt = rs.getInput("right") | |
46 | ||
47 | - | until rs.getAnalogInput("top") == 15 |
47 | + | if batt <= 3 |
48 | then | |
49 | fuelFeed("left", "Feed Online", colors.green, colors.white) | |
50 | sleep(180) | |
51 | end | |
52 | ||
53 | if batt >= 4 | |
54 | then | |
55 | standBy("Feed Offline", colors.yellow, colors.black) | |
56 | end | |
57 | ||
58 | end |