{"i":"EMWW","m":"get_firmware_info","p":{}}
{"m":"trigger_current_state","p":{}}
{"m":"program_modechange","p":{"mode":"play"}} // "mode": "play" or "download"
{"i":"ESGe","m":"set_hub_name","p":{"name":"U1BJS0U="}} // "name": Base64 string
# LEGO type:advanced slot:0 autostart | |
from runtime.virtualmachine import VirtualMachine # Needed for newer hub versions (3.1.43+) | |
import hub | |
from util.rotation import rotate_hub_display_to_value | |
rotates = ["1", "3", "4", "2"] | |
rotate_index = 0 | |
async def on_left_button_pressed(vm, stack): | |
print("Left button pressed") |
// | |
// ViewController.swift | |
// WebSocketInjection | |
// | |
// Created by Shinichiro Oba on 2021/03/18. | |
// | |
import UIKit | |
import WebKit |
from pybricks.hubs import CityHub | |
from pybricks.pupdevices import DCMotor, ColorDistanceSensor | |
from pybricks.parameters import Port, Color | |
from pybricks.tools import wait | |
hub = CityHub() | |
motor = DCMotor(Port.A) | |
color_sensor = ColorDistanceSensor(Port.B) | |
def wait_for_color(color): |
#!/usr/bin/env pybricks-micropython | |
from pybricks.hubs import EV3Brick | |
from pybricks.tools import wait | |
from pybricks.parameters import Button | |
from connection import SpikePrimeStreamReader | |
# Add send_command method into SpikePrimeStreamReader class | |
def send_command(self, command): | |
self.sock.send((command + '\r').encode()) |
MicroPython v1.9.4-1146-gca9944357 on 2019-10-03; LEGO Technic Large Hub with STM32F413xx | |
Type "help()" for more information. | |
>>> help() | |
Welcome to MicroPython! | |
For online help please visit http://micropython.org/help/. | |
Quick overview of commands for the board: | |
hub.info() -- print some general information | |
hub.status() -- print sensor data |
import gc | |
import micropython | |
import hub_runtime | |
micropython.alloc_emergency_exception_buf(256) | |
hub_runtime.start() |