The hardware is built.
The me shield is on the PI 3 B and connected to port 5 on the orion,
I used mblock 3.4.12 to upgrade the firmware.
I also used mblock scratch to test M1 and M2 motors
However it does not work. I ran the motorRunForOrion in the examples.
I removed statements until I received the following:
from megapi import *
if name == ‘main’:
bot = MegaPi()
bot.start()
bot.motorRun(M1,0);
sleep(1);
Python 3.5.3 (/usr/bin/python3)
%Run main-test3.py
Version:3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
init MegaPi
<megapi_python3.mSerial object at 0x76309690>
[Errno 25] Inappropriate ioctl for device
IF I add more sleep/delays:
from megapi import *
if name == ‘main’:
bot = MegaPi()
sleep(2)
bot.start()
sleep(2)
bot.motorRun(M1,0);
sleep(1)
========================= RESTART =========================
%Run main-test3.py
Version:3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
init MegaPi
<megapi_python3.mSerial object at 0x7632c790>
[Errno 25] Inappropriate ioctl for device
Traceback (most recent call last):
File “/home/pi/Documents/makeblock-link/main-test3.py”, line 7, in
bot.motorRun(M1,0);
File “/home/pi/.local/lib/python3.5/site-packages/megapi_python3.py”, line 202, in motorRun
self.__writePackage(bytearray([0xff,0x55,0x6,0x0,0x2,0xa,port]+self.short2bytes(speed)))
File “/home/pi/.local/lib/python3.5/site-packages/megapi_python3.py”, line 116, in __writePackage
self.device.writePackage(pack)
File “/home/pi/.local/lib/python3.5/site-packages/megapi_python3.py”, line 38, in writePackage
self.ser.write(package)
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 517, in write
raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open
NOTE: if name == ‘main’ has two underscores before and after each word