This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# good introduction video to "Pybricks": | |
# https://www.youtube.com/watch?v=Jmh4NLxJ_8c | |
from pybricks.pupdevices import DCMotor, ColorDistanceSensor | |
from pybricks.hubs import CityHub | |
from pybricks.tools import StopWatch | |
from pybricks.parameters import Port, Color | |
# Initialize the motor and the sensor. | |
motor = DCMotor(Port.B) | |
sensor = ColorDistanceSensor(Port.A) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pybricks.hubs import CityHub | |
from pybricks.pupdevices import DCMotor, Light, ColorDistanceSensor, PFMotor | |
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop | |
from pybricks.robotics import DriveBase | |
from pybricks.tools import wait, StopWatch | |
# Initialize the hub. | |
hub = CityHub() | |
trainMotor = DCMotor(Port.B, Direction.CLOCKWISE) | |
# Initialize the sensor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Debugging of new Widgets","widgets":[{"type":"TodoList","title":"Todo List","settings":{"todos":[]},"w":1,"h":2,"y":0,"x":0,"i":1637132303640,"guid":1637132303640,"moved":false},{"type":"PriceRunnerProductInfo","title":"PriceRunner Price","settings":{"country":"dk","productId":"5182343","name":"Canon EOS R"},"w":1,"h":1,"maxH":1,"y":3,"x":0,"i":1639685400928,"guid":1639685400928,"moved":false},{"type":"PriceRunnerProductInfo","title":"PriceRunner Price","settings":{"country":"dk","productId":"3200433833","name":"Sony A7 IV"},"w":1,"h":1,"maxH":1,"y":4,"x":0,"i":1639685407228,"guid":1639685407228,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"Stocks 📈"},"w":1,"h":1,"y":0,"x":1,"i":1639685490469,"guid":1639685490469,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"Weather 🌧"},"w":2,"h":1,"y":0,"x":4,"i":1639685553815,"guid":1639685553815,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"PriceRunner 📉"},"w":1,"h":1,"y":2,"x":0," |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tankSize": 50, | |
"name": "Toyota Corolla T-Sport" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Debugging of new Widgets","widgets":[{"type":"TodoList","title":"Todo List","settings":{"todos":[]},"w":1,"h":4,"y":0,"x":0,"i":1637132303640,"guid":1637132303640,"moved":false},{"type":"PriceRunnerProductInfo","title":"PriceRunner Price","settings":{"country":"dk","productId":"5182343","name":"Canon EOS R"},"w":1,"h":1,"maxH":1,"y":5,"x":0,"i":1639685400928,"guid":1639685400928,"moved":false},{"type":"PriceRunnerProductInfo","title":"PriceRunner Price","settings":{"country":"dk","productId":"3200433833","name":"Sony A7 IV"},"w":1,"h":1,"maxH":1,"y":6,"x":0,"i":1639685407228,"guid":1639685407228,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"Stocks 📈"},"w":1,"h":1,"y":0,"x":1,"i":1639685490469,"guid":1639685490469,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"Weather 🌧"},"w":2,"h":1,"y":0,"x":4,"i":1639685553815,"guid":1639685553815,"moved":false},{"type":"TextWidget","title":"Text","settings":{"message":"PriceRunner 📉"},"w":1,"h":1,"y":4,"x":0," |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Cardlay","widgets":[{"type":"RejseplanenDeparture","title":"Departure Board","settings":{"title":"Work","stationId":"461120000"},"w":2,"h":3,"y":0,"x":0,"i":6,"minH":2,"guid":1622718077849,"moved":false},{"type":"RejseplanenDeparture","title":"Departure Board","settings":{"title":"Home","stationId":"461097000"},"w":2,"h":3,"y":3,"x":0,"i":4,"minH":2,"guid":1622718140031,"moved":false},{"type":"TodoList","title":"Todo List","settings":{"todos":[]},"w":2,"h":5,"y":8,"x":0,"i":1625472114739,"guid":1625472114739,"moved":false},{"type":"Forecast","title":"Forecast","settings":{"city":"Holbaek","units":"metric"},"w":2,"h":3,"y":13,"x":0,"i":1625472279279,"guid":1625472279279,"moved":false},{"type":"Forecast","title":"Forecast","settings":{"city":"Odense","units":"metric"},"w":2,"h":3,"y":16,"x":0,"i":1626419010869,"minW":3,"minH":2,"guid":1626419010869,"moved":false},{"type":"Weather","title":"Weather","settings":{"city":"Odense","units":"metric"},"w":2,"h":1,"y":6,"x":0,"i":1638868326112,"minW":2,"minH":1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player.onChat("to me", function () { | |
agent.teleportToPlayer() | |
agent.turnRight(); | |
}) | |
function mineInFront () { | |
while(agent.detect(AgentDetection.Block, FORWARD)){ | |
agent.destroy(FORWARD); | |
} | |
agent.move(FORWARD, 1) | |
agent.destroy(UP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player.onChat("run", function (roofHeight) { | |
for (let index = 0; index <= 4; index++) { | |
builder.mark() | |
builder.move(FORWARD, roofHeight) | |
builder.raiseWall(POLISHED_ANDESITE, 5) | |
for (let index2 = 0; index2 < 2; index2++) { | |
builder.turn(RIGHT_TURN) | |
builder.move(FORWARD, 1) | |
} | |
builder.turn(RIGHT_TURN) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <FastLED.h> | |
#define LED_PIN 7 | |
#define NUM_LEDS 300 | |
#define FADE_AMOUNT 5 | |
#define MAX_BRIGHTNESS 255 | |
CRGB leds[NUM_LEDS]; | |
void setup() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GoHomeWithLoot () { | |
LastMiningPosition = agent.getPosition() | |
agent.teleport(Home, WEST) | |
agent.dropAll(DOWN) | |
agent.teleport(LastMiningPosition, WEST) | |
player.say("start mining") | |
} | |
function CheckForGravel () { | |
while (blocks.testForBlock(GRASS, positions.add( | |
agent.getPosition(), |
NewerOlder