tag:blogger.com,1999:blog-4536636212142504599.post6039789146625871486..comments2023-02-11T08:31:10.251-08:00Comments on EV3 Direct Commands: Lesson 1 - The art of doing nothingChristophhttp://www.blogger.com/profile/03757631301217576260noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-4536636212142504599.post-70602222433910116822022-03-23T23:02:59.652-07:002022-03-23T23:02:59.652-07:00Hello,
I managed to run my code with my own envir...Hello,<br /><br />I managed to run my code with my own environment. I believe it was permission error with my windows and I couldn't get it to work. Once I use linux, it works out just fine. And also, ev3_dc let me run my code on my own PC environment, which is what I have been looking for. Thank you so much.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-49690318609292636682022-02-25T05:43:08.152-08:002022-02-25T05:43:08.152-08:00Hello,
I expect, you run a copy of the python prog...Hello,<br />I expect, you run a copy of the python program example. What happens, when you install package ev3_ dc and use this one? Can you please give me some additional information about your error situation. Which statment causes the error?<br />Kind regards,<br />ChristophChristophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-4074438556993421792022-02-22T23:35:55.465-08:002022-02-22T23:35:55.465-08:00Hello Cristoph,
Currently I am trying to connect ...Hello Cristoph,<br /><br />Currently I am trying to connect my EV3 brick via Windows on anaconda environment. I have installed the pyusb module library in the environment. However, I keep getting error of "Operation not supported or unimplemented on this platform". I am guessing that it has something to do with the permission. Any idea about this? Any hep would be very appreciated.<br /><br />Thank youAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-78592981331333126252021-06-18T00:56:03.483-07:002021-06-18T00:56:03.483-07:00Hello Christoph,
it turns out that the ev3dev proj...Hello Christoph,<br />it turns out that the ev3dev project does _not_ support direct commands. <br />Kind regards<br />CarstenCarlonoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-38565096384471802742021-06-14T04:25:52.852-07:002021-06-14T04:25:52.852-07:00Hi Carsten,
please keep me informed, if and how di...Hi Carsten,<br />please keep me informed, if and how direct commands work with ev3dev too. If this is the case and it is possible to establish a socket, then it is worth to be included into my ev3_dc module. Direct commands are more or less machine code of the EV3, therefore the chances seem to be not so bad.<br /><br />Thanks and kind regards,<br />ChristophChristophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-17973992638511807622021-06-13T03:27:10.666-07:002021-06-13T03:27:10.666-07:00Hi Christoph,
thanks a lot for your answer and hin...Hi Christoph,<br />thanks a lot for your answer and hint.<br />In deed, the program works fine when I remove the SD card. <br />Because of my other litte projects I'd be however quite happy to use direct commands with the ev3dev os. With the timeout codelines included, as expected, I get the timeout exception. Same for a range of other port numbers, which I checked looping your code. Obviously it's not efficient to test all possible values, so I contacted the ev3dev community.<br /><br />For the time being I'll go on using direct commands with the original os. It's great to know you are out there in case I run in trouble with this. <br />Thank you<br />CarstenCarlonoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-35202556668341316952021-06-07T10:58:48.043-07:002021-06-07T10:58:48.043-07:00Hello Carsten,
welcome for your warm feedback.
F...Hello Carsten,<br /><br />welcome for your warm feedback.<br /><br />First attempt, set a timeout (like module ev3_dc does):<br /><br /> UDPSock.settimeout(10)<br /> UDPSock.bind(('', 3015))<br /> try:<br /> data, addr = UDPSock.recvfrom(1024)<br /> except socket.timeout:<br /> raise ...<br /><br />I expect you will see the timeout. This indicates, v3dev does not send a broadcast message on port 3015, as you expeted too.<br /><br />What happens, when you remove the ev3dev SD-card and boot your EV3 device with its original operating system and then run your program?<br /><br />Sorry, but I don't know the details of ev3dev.<br /><br />Kind regards,<br />ChristophChristophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-38432917796162311372021-05-30T01:20:16.603-07:002021-05-30T01:20:16.603-07:00Thanks a lot for your so empathetic and yet so ana...Thanks a lot for your so empathetic and yet so analytic blog. <br />I try to connect the brick with an ev3dev.org image to a machine running macOS Catalina via WiFi, using EV3_do_nothing_wifi.py . After executing the line "UDPSock.bind(('', 3015))" there is no further output. I reckon it waits to receive data on port 3015 but does not get any. I would guess the ev3dev software sends the UDP data on a different port? How could I find out which port to bind?<br />I'm using Kernel 4.14.117-ev3dev-2.3.5-ev3 on the lego brick<br />Thanks so much in advance<br />CarstenCarlonoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-15296509056736845302020-11-14T21:44:13.442-08:002020-11-14T21:44:13.442-08:00This is most informative and also this post most u...This is most informative and also this post most user friendly and super navigation to all posts. <a href="https://www.simfront.com/" rel="nofollow">OTH Gold</a>simfronthttps://www.blogger.com/profile/07211820817001768742noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-19586676310441764102019-03-30T09:59:38.595-07:002019-03-30T09:59:38.595-07:00Hi Konstantin,
congratulations!
Christoph Hi Konstantin, <br />congratulations!<br />Christoph Christophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-17369494513733934772019-03-30T01:48:47.219-07:002019-03-30T01:48:47.219-07:00Was my mistake. Now it's playing soundWas my mistake. Now it's playing soundAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-68658639201829191172019-03-30T01:43:38.959-07:002019-03-30T01:43:38.959-07:00It works! Though when I send your sound example mo...It works! Though when I send your sound example motor starts running instead of playing sound. But anyway I can communicate with ev3 now. <br />Thank you so much! <br />KonstantinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-68041036015338474422019-03-30T01:08:17.396-07:002019-03-30T01:08:17.396-07:00Thank you, Christoph!
Server stars responding!! W...Thank you, Christoph! <br />Server stars responding!! When I sent [0x06, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x01], I got * from the server. Not the correct answer, but this might be a decoding issue with server's message. I still do not quite understand how to convert sound or motor command to [UInt8] to check if it works.<br /><br />Thanks,<br />KonstantinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-1685885780472852582019-03-29T13:22:12.377-07:002019-03-29T13:22:12.377-07:00Hi Konstantin,
I did never code in Swift, but I th...Hi Konstantin,<br />I did never code in Swift, but I think, an array of UInt8 (unsigned integer 8-Bit) is the byte type in Swift. If you send this data:<br /><br />let byteArray: [UInt8] = [0x06, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x01]<br /><br />This is, what my notation 0x|06:00|2A:00|00|00:00|01| means.<br /><br />You should get the correct answer from your EV3 device, which also is an UINt8 array:<br /><br />[0x03, 0x00, 0x2A, 0x00, 0x02]<br />or in my notation: 0x|03:00|2A:00|02|<br /><br />Playing sound is a bit more complicated, but you find examples in lesson 2, e.g. 0x|0E:00|2A:00|80|00:00|94|01|01|82:B8:01|82:E8:03| to play a tone of 440 Hz for one second<br /><br />Starting motors is described in lesson 3, e.g.<br />0x|0D:00|2A:00|80|00:00|A4|00|0F|81:64|A6|00|0F|<br /><br />Kind regards<br />ChristophChristophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-17059170870173018562019-03-28T14:22:07.650-07:002019-03-28T14:22:07.650-07:00Christoph,
I work with Swift. Could you please gi...Christoph,<br /><br />I work with Swift. Could you please give me an example of direct command in utf8 array [] format? Something with playing sound or run motor.<br /><br />Thanks,<br /><br />KonstantinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-69335950867567714932019-03-11T12:47:48.198-07:002019-03-11T12:47:48.198-07:00Hello,
you successfully established a connection, ...Hello,<br />you successfully established a connection, but then did not get an answer from your EV3-device? I suppose you code in java. Did you use a byte[] for the direct command? This is a bit tricky, because the broadcast message, the unlock message are of type String. What you want to send as your direct command is an array of 8 bytes. Please check, what type of data you did send.<br />Kind regards<br />Christoph Christophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-69484417299994216202019-03-04T10:47:14.007-08:002019-03-04T10:47:14.007-08:00Thank you so much for your blog, Christoph!
I am t...Thank you so much for your blog, Christoph!<br />I am trying to send direct commands to ev3 from iOS device. I am using a simple terminal app and I was able to send "ET /target?sn=" and get a respond from ev3 ”Accept:EV340”. As I understand it means that a WiFi connection is established between the host device and the EV3 brick. But after that when I send any direct command nothing happens. No respond. I tried 0x|06:00|2A:00|00|00:00|01| and some other commands. May be I am using a wrong format? What command can send to check if it works?<br />Would you please help me?<br />Thanks!<br />Anonymoushttps://www.blogger.com/profile/07560594995307051131noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-58789808434899969602018-10-29T20:42:14.445-07:002018-10-29T20:42:14.445-07:00With windows 10, I have tried and succeeded to con...With windows 10, I have tried and succeeded to connect to my EV3 device.Anonymoushttps://www.blogger.com/profile/15695602915470100492noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-82079547145163968742018-01-22T02:05:48.053-08:002018-01-22T02:05:48.053-08:00Fantastic tutorial, I had been trying to connect v...Fantastic tutorial, I had been trying to connect via python/USB on my own, but I was missing several parts of the puzzle. This was exactly what I needed to read, to the point and not over engineered. Thanks!Erik Karlstörmnoreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-11515329774116929252018-01-04T09:25:37.625-08:002018-01-04T09:25:37.625-08:00Hi Hazem,
congratulations! You connected your EV3 ...Hi Hazem,<br />congratulations! You connected your EV3 device and obviously it correctly processed the direct command. Now you can start to do real things!<br />I think, I understand the error, you got. 00:16:53:42:2B:99 is the mac-address of my EV3 device. Your device has a different one. You can read the mac-address from your EV3's display under Brick Info / ID. Please modify the program by resetting the mac-address, then you can uncomment the line and it should work. For the moment you ask for any EV3 device in your network, which is o.k. as long as there is only a single EV3.Christophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-78230027785831196742018-01-03T20:48:22.331-08:002018-01-03T20:48:22.331-08:00Thanks
This is great stuff!
I got a wifi dongle,...Thanks <br />This is great stuff!<br /><br />I got a wifi dongle, and I am switching to try the python wifi.<br /><br />I got this as a result of running the python code, which I believe is the right output:<br /><br />Sent 0x|06:00:2A:00:00:00:00:01|<br />Recv 0x|03:00:2A:00:02|<br /><br /><br />However this was possible only after I commented the line:<br /> ## raise ValueError('found ev3 but not ' + host)<br /><br />Prior to that, I had the following error:<br />raise ValueError('found ev3 but not ' + host)<br />ValueError: found ev3 but not 00:16:53:42:2B:99<br /><br />I appreciate your comment on that.<br />Hazemhttps://www.blogger.com/profile/17764257102425370805noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-83180570974379937302018-01-02T12:53:43.065-08:002018-01-02T12:53:43.065-08:00Hi Hazem,
I described an alternative bluetooth soc...Hi Hazem,<br />I described an alternative bluetooth socket using pybluez and I modified the text of Lesson 1. You find it under Bluetooth python. My trial was successfull and I'm curious, if it also works with Windows 10. Please give it a try and tell me if you succeeded to connect your EV3 device.Christophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-463360716285859212018-01-02T09:14:53.180-08:002018-01-02T09:14:53.180-08:00Thanks for your reply.
You are absolutely right. ...Thanks for your reply.<br /><br />You are absolutely right. I tried to RUN the code using python3.6.4 under Windows10 Hazemhttps://www.blogger.com/profile/17764257102425370805noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-23021476839093055432018-01-01T07:15:24.058-08:002018-01-01T07:15:24.058-08:00Hi,
if socket does not support bluetooth, you can ...Hi,<br />if socket does not support bluetooth, you can install pybluez and import bluetooth instead of socket. In my case I did the following:<br /><br />1) Install pybluez<br /><br />sudo pip3 install pybluez<br /><br /><br />2) Change the program to:<br /><br />#!/usr/bin/env python3<br /><br />import bluetooth<br />import struct<br /><br />class EV3():<br /> def __init__(self, host: str):<br /> self._socket = bluetooth.BluetoothSocket(<br /> bluetooth.RFCOMM<br /> )<br /> self._socket.connect((host, 1))<br /><br /> def __del__(self):<br /> if isinstance(self._socket, bluetooth.BluetoothSocket):<br /> self._socket.close()<br />...<br /><br /><br />3) run the modified program with<br /><br />python3 python_do_nothing.py<br /><br /><br />I hope, this helps!<br /><br />Yours<br />ChristophChristophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.comtag:blogger.com,1999:blog-4536636212142504599.post-12419029792133862992018-01-01T06:21:17.356-08:002018-01-01T06:21:17.356-08:00Hi,
i conclude from your error message, that you r...Hi,<br />i conclude from your error message, that you run this program on Windows and python 3.6. Is that correct? The functionality of socket depends on the system of your computer. Can you please tell some additional information?<br />Christophhttps://www.blogger.com/profile/03757631301217576260noreply@blogger.com