This file contains 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
#!/usr/bin/env pybricks-micropython | |
# SPDX-License-Identifier: MIT | |
# Copyright (c) 2024 David Lechner <dlechner@baylibre.com> | |
import math | |
from pybricks.hubs import EV3Brick | |
from pybricks.ev3devices import Motor, InfraredSensor | |
from pybricks.parameters import Port, Direction, Button | |
from pybricks.tools import wait |
This file contains 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
#!/usr/bin/env python | |
# | |
# ev3dev-lang-python program for the Robot Arm H25 model that is part of | |
# the 45544 LEGO Education EV3 kit. | |
# | |
# Authors: | |
# David Lechner <david@lechnology.com> | |
# | |
from ev3dev.ev3 import * |
This file contains 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
# SPDX-License-Identifier: MIT | |
# Copyright (c) 2021 David Lechner <david@pybricks.com> | |
# A program for LEGO MINDSTORMS Robot Inventor - Gelo | |
# Developed using MINDSTORMS App v1.3.4 (10.1.0), hub firmware v1.2.01.0103 | |
# Building instructions: https://www.lego.com/cdn/product-assets/product.bi.additional.main.pdf/51515_Gelo.pdf | |
# Hub API: https://lego.github.io/MINDSTORMS-Robot-Inventor-hub-API/ |
This file contains 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
// ==UserScript== | |
// @name Pybricks Code Full Screen Editor | |
// @namespace https://pybricks.com/tampermonkey/full-screen-editor | |
// @version 1.0.0 | |
// @description Full screen text editor for Pybricks Code. | |
// @author David Lechner | |
// @match https://code.pybricks.com | |
// @match https://beta.pybricks.com | |
// @icon https://pybricks.com/favion.ico | |
// @grant none |
This file contains 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
# spike.control.wait_for_seconds doesn't allow decimal points | |
# so we replace it with the standard MicroPython sleep function instead | |
from utime import sleep as wait_for_seconds | |
from utime import ticks_diff, ticks_ms | |
# See https://docs.micropython.org/en/latest/library/utime.html for more info on the utime module | |
from spike import (PrimeHub, LightMatrix, Button, StatusLight, ForceSensor, MotionSensor, | |
Speaker, ColorSensor, App, DistanceSensor, Motor, MotorPair) | |
from spike.control import wait_until |
This file contains 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
// ==UserScript== | |
// @name Square names | |
// @source https://gist.github.com/dlech/2e0e9304458b9f7b816a59e3f187a04b | |
// @namespace com.lechnology.chess.squares | |
// @version 1.0.0 | |
// @description Display the square names on each square. | |
// @author David Lechner | |
// @match https://www.chess.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains 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
#!/usr/bin/env python3 | |
# | |
# gyroboy.py - translation of the LEGO Education GyroBoy program to python for ev3dev | |
# | |
# MIT License | |
# | |
# Copyright (c) 2016 David Lechner <david@lechnology.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal |
This file contains 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
#!/usr/bin/env python | |
# Python port of the HiTechnic HTWay for ev3dev | |
# Copyright (c) 2014-2015 G33kDude, David Lechner | |
# HiTechnic HTWay is Copyright (c) 2010 HiTechnic | |
import itertools | |
import os | |
import struct |
This file contains 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
import smbus | |
import time | |
for bus in range(3, 7): | |
try: | |
i2c = smbus.SMBus(bus) | |
print "Input port %d:" % (bus - 2) | |
for addr in range(0x01, 0x80, 2): | |
try: | |
for offset in range(0, 24, 8): |
This file contains 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 PrimeHub | |
from pybricks.experimental import Remote | |
from pybricks.pupdevices import Motor | |
from pybricks.parameters import Button, Port, Direction | |
from pybricks.robotics import DriveBase | |
from pybricks.tools import wait | |
DRIVE_SPEED = 400 | |
hub = PrimeHub() |
NewerOlder