Skip to main content

jacarEV3

jacarEV3 🐊

Lib em português pra controlar o LEGO EV3 via Bluetooth. Sem dependências externas — só biblioteca padrão do Python.

PyPI License: MIT

Instalação

pip install jacarev3

Ou pra desenvolver localmente:

git clone https://github.com/i-barbosa/jacarEV3.git
cd jacarEV3
pip install -e . --break-system-packages

Uso rápido

from jacarev3 import RoboEV3

robo = RoboEV3('00:16:53:64:F8:B8')  # MAC do seu EV3

robo.apitar()
robo.led('VERDE')

robo.testar_tudo()  # testa motores A-D e sensores 1-4

robo.fechar()

Ou com with (fecha a conexão sozinho):

with RoboEV3('00:16:53:64:F8:B8') as robo:
    robo.apitar()
    robo.testar_motores()

Exemplos por funcionalidade

Som

robo.apitar()                                  # bip padrão
robo.apitar(frequencia=880, duracao_ms=300)    # agudo e curto
robo.apitar(volume=5)                          # mais alto (1-100)

LED

robo.led('VERDE')
robo.led('VERMELHO_PISCA')
robo.led('DESLIGADO')

Motor

# Gira pra frente 1s, velocidade 30%
robo.girar_motor('A', velocidade=30, duracao_ms=1000)

# Gira pra trás (velocidade negativa)
robo.girar_motor('A', velocidade=-30, duracao_ms=1000)

# Solta o motor sem frear (roda livre)
robo.parar_motor('A', frear=False)

# Testa um motor específico
robo.testar_motor('B')

# Testa A, B, C, D de uma vez (pula os vazios com aviso)
robo.testar_motores()

Sensores

# Cada teste espera o valor MUDAR de verdade antes de seguir
# (aproxima algo do ultrassônico, aperta o toque, muda a cor)
robo.testar_ultrassonico(porta=1)
robo.testar_toque(porta=2)
robo.testar_cor(porta=3)

# Testa só alguns tipos, tempo de espera customizado
robo.testar_sensores(tipos=('toque', 'cor'), tempo_limite=10)

API completa

Som e LED

Método Descrição
apitar(frequencia=440, duracao_ms=500, volume=1) Toca um bip
led(cor) VERDE, VERMELHO, AMBAR, DESLIGADO, e variantes _PISCA / _PULSA

Motores (portas A-D)

Método Descrição
girar_motor(porta, velocidade=30, duracao_ms=1000, frear=True) Velocidade de -100 a 100
parar_motor(porta, frear=True) Para o motor
testar_motor(porta) Testa um motor específico
testar_motores() Testa A, B, C, D de uma vez

Sensores (portas 1-4)

Método Descrição
testar_ultrassonico(porta, tempo_limite=15) Espera a distância mudar
testar_toque(porta, tempo_limite=15) Espera pressionado/solto
testar_cor(porta, tempo_limite=15) Espera a cor mudar
testar_sensores(tipos=(...), tempo_limite=15) Testa os 3 tipos nas 4 portas
testar_tudo(tempo_limite=15) Motores + todos os sensores

Troubleshooting

OSError / timeout ao conectar Confirma que o EV3 tá pareado nas Configurações Bluetooth do Windows/Linux e que o Bluetooth dele tá visível/ligado antes de rodar o script.

[AVISO] Sem motor (ou erro) na porta X Normal se não tiver motor físico conectado nessa porta — o método pula e segue pros outros.

speed must be in range [1-100] Velocidade tem que ser um valor entre -100 e 100 (direção pelo sinal, não por valores fora do range).

EV3 respondeu com erro pro comando Geralmente é modo/porta errada no sensor (ex: pedir leitura de cor num sensor de toque). Confere se o sensor físico bate com o tipo do método chamado.

Status

v0.1.0 — protocolo validado byte a byte contra a documentação oficial da LEGO (Communication Developer Kit), ainda em bateria de testes no robô físico. Veja CHANGELOG.md pro histórico de versões.

Contribuindo

Issues e PRs são bem-vindos em github.com/i-barbosa/jacarEV3.

Licença

MIT — veja LICENSE.

Release files for jacarev3 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jacarev3 0.2.0
File Size Uploaded
jacarev3-0.2.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jacarev3 0.2.0
File Interpreter ABI Platform
jacarev3-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / jacarev3-0.2.0.tar.gz

Download URL jacarev3-0.2.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f52086338f13999927c2a51c45fa21ac8293fbac205c0911b6531944269e7d86
BLAKE2b-256 checksum
How to use checksums
0fd9ff31d222a0f762d8e3414717addc627267fad3dcf2f3f12d4c43c8ad2aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / jacarev3-0.2.0-py3-none-any.whl

Download URL jacarev3-0.2.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
567dbface6ad37b53100eea0421b7d550cd53fd3d5b86291352bf4c359d4c2d5
BLAKE2b-256 checksum
How to use checksums
f2cc72dc88f52839b39d3f04d7c7a877ed9b277dc62c2f72ca27429e60a1b7fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page