quarta-feira, 1 de outubro de 2025

Programar em Python no EV3 por Bluetooth no Debian 13

 
Crie o SDCard
https://www.ev3dev.org/downloads/
https://education.lego.com/en-us/product-resources/mindstorms-ev3/teacher-resources/python-for-ev3/

Documentação
https://docs.pybricks.com/en/v2.0/index.html

IDE
https://vscodium.com/

Extensão
https://open-vsx.org/vscode/item?itemName=ev3dev.ev3dev-browser

Com isso vc consegue usar seu ev3 pelo cabo USB.

Agora vamos preparar o pc para usar pelo Bluetooth

Instale no Debian 13:
sudo apt install bluez

Wireless and Networks >
Bluetooth >
Powered [x]
Visible [x]

Escaneie no PC e confirme no EV3

Wireless and Networks >
Tethering>
Bluetooth [x]

Inicie a conexão e aceite no EV3:
Authorize service BNEP? Accept

Código main.py de exemplo:
#!/usr/bin/env pybricks-micropython

## exemplo
# fonte: https://docs.pybricks.com/en/v2.0/start_ev3.html
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
from pybricks.parameters import Port

# Create your objects here

# Initialize the EV3 Brick.
ev3 = EV3Brick()

# Initialize a motor at port B.
#test_motor = Motor(Port.B)

# Write your program here

# Play a sound.
ev3.speaker.beep()

# Escrever na tela
ev3.screen.clear()
ev3.screen.print("Ola Mundo!")

# Falar
ev3.speaker.set_speech_options("pt-br")
ev3.speaker.say("Ola Mundo")

# Run the motor up to 500 degrees per second. To a target angle of 90 degrees.
#test_motor.run_target(500, 90)

# Play another beep sound.
ev3.speaker.beep(frequency=1000, duration=500)

PROXMOX passthrough GPU

No Servidor Proxmox

nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet iommu=pt"

update-grub

nano /etc/modules-load.d/vfio.conf
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

update-initramfs -u -k all

reboot

Para conferir: 

lsmod | grep vfio
dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
pvesh get /nodes/$(hostname)/hardware/pci --pci-class-blacklist ""

Na VM
Configure os repositorios adicionais:
vi /etc/apt/sources.list
contrib non-free non-free-firmware

apt update
apt install nvidia-driver
apt install linux-headers-$(uname -r)


Problemas encontrados sem uma explicação:

- Não use EFI em vez disso use:
bios: seabios

- Especifique o Display como Standard VGA (std), normalmente uso vga: serial0
vga: std