serial error when tethering with windows

Help and questions on programming the codebug
Post Reply
sdcurtin
Posts: 11
Joined: Sun Mar 06, 2016 9:36 pm

serial error when tethering with windows

Post by sdcurtin » Sat Dec 03, 2016 12:03 pm

Hi,
I've installed Python 3.5.2 on a Windows 8.1 tablet and am running into issues running the examples.
I get the following line when attempting to import codebug_tether
Traceback (most recent call last):
File "blinkers.py", line 5, in <module>
import codebug_tether
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\__init__.p
y", line 1, in <module>
from codebug_tether.core import (CodeBug,
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\core.py",
line 3, in <module>
import serial
ImportError: No module named 'serial'
This all happens when I try import codebug_tether inside the python shell.
Any ideas what's going on?
I also tried pip install serial and there's no such module.
C:\Users\Issys User\Documents\Codebug>pip install serial
Collecting serial
Could not find a version that satisfies the requirement serial (from versions:
)
No matching distribution found for serial

BTW the examples for Windows up on
http://codebug-tether.readthedocs.io/en ... all-python
don't mention you have to start the python shell before trying the interactive commands

Zez
Posts: 1
Joined: Thu Dec 08, 2016 11:03 am

Re: serial error when tethering with windows

Post by Zez » Thu Dec 08, 2016 11:12 am

Hi man, i had the same problem as you after 2 days of google and rage...
Install pySerial and this error is gone. (as it mentioned " Next, you need to install some Python modules") IF you can make it work and light up 1 led tell me because i can't (Assertion Error)

sdcurtin
Posts: 11
Joined: Sun Mar 06, 2016 9:36 pm

Re: serial error when tethering with windows

Post by sdcurtin » Mon Jan 02, 2017 5:31 pm

Yes adding piSerial helped a lot. I also had to specify which port the Codebug was running in,
so the code from blockly had to be modified like this:
import codebug_tether
import serial
codebug = codebug_tether.CodeBug("COM4")
codebug.set_pixel(2, 2, 1)
You'll have to run device manager and check which COM port
has been assigned to USB serial port, that's the codebug's FTDI chip.

Next problem...
If I run a loop in python it will abort within about five minutes
with the following error:
Traceback (most recent call last):
File "blinkers3.py", line 81, in <module>
if codebug.get_pixel(0, 0) == 1 and codebug.get_pixel(0, 0) == 1:
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\core.py",
line 325, in get_pixel
return self.get_bit(channel, bit_index)
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\serial_cha
nnel_device.py", line 157, in get_bit
value = struct.unpack('B', self.get(channel_index))[0]
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\serial_cha
nnel_device.py", line 61, in get
struct.pack('B', (CMD_GET << 5) | (channel_index & 0x1f)))
File "C:\Program Files\Python35-32\lib\site-packages\codebug_tether\serial_cha
nnel_device.py", line 200, in transaction
assert self.serial_port.read(1) == ACK_BYTE
AssertionError
Might be a hardware or grounding issue?

sdcurtin
Posts: 11
Joined: Sun Mar 06, 2016 9:36 pm

Re: serial error when tethering with windows

Post by sdcurtin » Tue Jan 03, 2017 5:30 pm

Answering my own question, it's a Dell issue :x
The OTG adapter to the Dell tablet it's connected to
has a switch in it between power and data,
and it seems to switch between them in a way
that tethered mode doesn't like.
After removing the power cable and letting it run
on battery, the loop ran over an hour just fine.

Post Reply