Closed MrCheatEugene closed 2 years ago
Thanks for sharing this code. This looks like the code from one of your EV3s. Can you share the code of the other one too?
What is the brick name of this EV3, and what is the name of the other?
Thanks for sharing this code. This looks like the code from one of your EV3s. Can you share the code of the other one too?
What is the brick name of this EV3, and what is the name of the other?
The code of the second EV3 is lost, unfortunatly, basically it was a BT connection, then a loop that had a switch inside of it, which checked the state of which button on EV3 is pressed, and then it sent the numeric message with mailbox name 'mouse', and with contents from 1 to 5.
Name of the stock firmware EV3 is EV31, and the name of the ev3 with micropython is ev3dev.
Thanks for sharing this code. This looks like the code from one of your EV3s. Can you share the code of the other one too? What is the brick name of this EV3, and what is the name of the other?
The code of the second EV3 is lost, unfortunatly, basically it was a BT connection, then a loop that had a switch inside of it, which checked the state of which button on EV3 is pressed, and then it sent the numeric message with mailbox name 'mouse', and with contents from 1 to 5.
Name of the stock firmware EV3 is EV31, and the name of the ev3 with micropython is ev3dev.
Also, the code on the second EV3 was not written in python, but in the LEGO EV3 Home edition software for Windows.
I've noticed that when I try to connect to a "ev3dev" block, in "Connections" menu in the stock-firmware EV3, "(exclamation mark in a triangle)Error!" message immediately. When I try to connect to EV31 in ev3dev I get a "GDBus.Error.org.bluez.Error.NotAvaliable: Operation currently not avaliable" message.
I've forgot one little thing. That program written using EV3's software tried to connect to EV3, not ev3dev. Re-writing this program again, and after making some more changes to Python script, it now works perfectly. The final Python code:
#!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port, Stop, Direction, Button, Color
from pybricks.tools import wait, StopWatch, DataLog
from pybricks.robotics import DriveBase
from pybricks.media.ev3dev import SoundFile, ImageFile
from pybricks.messaging import BluetoothMailboxClient, NumericMailbox
import time
# This program requires LEGO EV3 MicroPython v2.0 or higher.
# Click "Open user guide" on the EV3 extension tab for more information.
# Create your objects here.
ev3 = EV3Brick()
client = BluetoothMailboxClient()
mbox = NumericMailbox('mouse',client)
print('establishing connection...')
client.connect('EV31')
print('connected!')
mbox.wait()
while(True):
print(mbox.read())
time.sleep(1)
pass
# Write your program here.
#ev3.speaker.beep()
Glad you figured it out.
If it's not too much trouble, would you mind pasting a screenshot of that program here? That would make it easy for people who find this issue via Google in the future.
Glad you figured it out.
If it's not too much trouble, would you mind pasting a screenshot of that program here? That would make it easy for people who find this issue via Google in the future.
Here it is.
Hi there. I am trying to recieve the message from EV3 with MicroPython, and send from EV3 with the stock OS.
But, I have trouble connecting them. While they are paired and connected, the program crashes with 'OSError: 112'. Code:
EDIT: Also, I've noticed that on my EV3 I have a file main.py.err.log,and here is the contents of that file:
It seems like the ev3 with the stock firmware refused to connect? Also the stock-firmware EV3 beeps with low tone very short time, turns orange(or red?) LED's on, and displays warning sign with 1.5 lego blocks(like in the EV3 software) with an exclamation point. Why could that happen?