Coder Social home page Coder Social logo

codebug_tether's People

Contributors

cymplecy avatar thomasmacpherson avatar tompreston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

codebug_tether's Issues

Issues with set_pullup()

Hi

I'm trying to use set_pullup to set leg 0 to high, using set_pullup(0, 1) but keep getting an error that:

self.set_bit(CHANNEL_INDEX_PULLUPS, input_index, direction)
NameError: name 'direction' is not defined

Looking into the core.py file on here, the set_pullup takes three parameters, self, input_index, and state. This state parameter is never used but an undefined (probably) variable direction, is then used to call self.set_bit. Should this be state instead?

Cheers
Dave

PWM output 3x expected frequency

Using codebug_tether with pwm_freq(1000) the actual output frequency appears to be 3kHz on an oscilloscope. Similarly, using pwm_freq(2000) actually outputs 6kHz. This seems to reproduce on both 0.7.0 and 0.7.3 firmware. However, when using a code block with "start tone (Hz) [1000]" the output is exactly 1kHz on the oscilloscope as expected.

The code used is as follows:
cb = codebug_tether.CodeBug()
cb.set_leg_io(0, IO_PWM_OUTPUT)
cb.pwm_freq(1000)
time.sleep(2)
cb.pwm_off()

Finding Win7 driver

While trying out ScratchCodeBug...

Initially, copying and executing codebug_tether.cbg on my CodeBug, connected to my Win7 laptop, failed. In Device Manager it showed "drivers not installed" (see http://snag.gy/ll4LY.jpg) and no sign of a USB Serial Port.

I tried downloading and installing the FTDI driver and now have a USB Serial Port but "device cannot start" (see http://snag.gy/BKARo.jpg).

From comparison with a working Win/CodeBug setup I gather I may need a driver from Microchip Technology Inc (see http://snag.gy/uNoyv.jpg). Current next step is try to find one...

AssertionError

Following the guide on the readthedocs website, I get an AssertionError when trying the first set_row line:

codebug.set_row(0, 5)

Not sure it's connected to the given device - how do I check? Is this the right place to ask for support?

AssertionError#2

Hi, we have the same problem as hippyjim had.
None of the commands work, same error always.
Should mention install pySerial in the tutorial btw for the noobs like me
Using Win10, Codebug is connecting as COM2
Downloaded the 0.8.5 cbg

import codebug_tether
codebug = codebug_tether.CodeBug()
codebug.set_pixel(2, 1, 1)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in
codebug.set_pixel(2, 1, 1)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\codebug_tether\core.py", line 313, in set_pixel
self.set_bit(channel, bit_index, state)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\codebug_tether\serial_channel_device.py", line 151, in set_bit
self.or_mask(channel_index, 1 << bit_index)
File "C:\Users\Asus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\codebug_tether\serial_channel_device.py", line 146, in or_mask
bytes((mask,)))
File "C:\Users\Asus\AppData\Local\Programs\Python\Python35-32\lib\site-packages\codebug_tether\serial_channel_device.py", line 200, in transaction
assert self.serial_port.read(1) == ACK_BYTE
AssertionError

USB Device not recognised

Getting this error message after loading the tether firmware

Loading in a normal .cbg file works fine

http://snag.gy/GDsTQ.jpg

Its showing up as having an Invalid Configuration Descriptor in Windows device manager
using Win 8.1 64bit

Digital outputs 0 and 1 not working on v0.8.0

When I use tether firmware v0.8.0, digital outputs 0 and 1 don't seem to work properly. They are at about 0.5 volts all the time. Legs 2 and 3 work as expected. When I use firmware v0.7.3, this doesn't happen and all legs work as expected.
Digital and analogue inputs work as expected in both v0.7.3 and v0.8.0 firmware version. PWM not tested.
Has adding the servo support somehow affected digital outputs?

Raspbian Jessie gets a kernel panic when Codebug is connected

I'm getting this

[413775.644294] ------------[ cut here ]------------
[413775.644319] WARNING: CPU: 2 PID: 8289 at drivers/usb/core/urb.c:450 usb_submit_urb+0x1cc/0x4b8()
[413775.644338] usb 1-1.4: BOGUS urb xfer, pipe 3 != type 1
[413775.644356] Modules linked in: cdc_acm sg binfmt_misc nfsd rtc_ds1307 cfg80211 rfkill rpcsec_gss_krb5 8188eu(O) evdev i2c_bcm2708 spi_bcm2835 uio_pdrv_genirq uio bcm2708_rng i2c_dev snd_bcm2835 snd_pcm snd_timer snd fuse ipv6
[413775.644528] CPU: 2 PID: 8289 Comm: python3 Tainted: G        W  O    4.0.9-v7+ #807
[413775.644536] Hardware name: BCM2709
[413775.644555] [<800175bc>] (unwind_backtrace) from [<80012fd4>] (show_stack+0x20/0x24)
[413775.644572] [<80012fd4>] (show_stack) from [<8054720c>] (dump_stack+0x98/0xe0)
[413775.644589] [<8054720c>] (dump_stack) from [<8002507c>] (warn_slowpath_common+0x8c/0xc8)
[413775.644607] [<8002507c>] (warn_slowpath_common) from [<800250f8>] (warn_slowpath_fmt+0x40/0x48)
[413775.644626] [<800250f8>] (warn_slowpath_fmt) from [<803c31cc>] (usb_submit_urb+0x1cc/0x4b8)
[413775.644645] [<803c31cc>] (usb_submit_urb) from [<7f05c6e8>] (acm_submit_read_urb+0x50/0x94 [cdc_acm])
[413775.644669] [<7f05c6e8>] (acm_submit_read_urb [cdc_acm]) from [<7f05e194>] (acm_submit_read_urbs.constprop.22+0x38/0x58 [cdc_acm])
[413775.644693] [<7f05e194>] (acm_submit_read_urbs.constprop.22 [cdc_acm]) from [<7f05e2b4>] (acm_port_activate+0x100/0x154 [cdc_acm])
[413775.644713] [<7f05e2b4>] (acm_port_activate [cdc_acm]) from [<8033ab2c>] (tty_port_open+0x8c/0xcc)
[413775.644737] [<8033ab2c>] (tty_port_open) from [<7f05cef8>] (acm_tty_open+0x2c/0x30 [cdc_acm])
[413775.644757] [<7f05cef8>] (acm_tty_open [cdc_acm]) from [<80332f64>] (tty_open+0xb8/0x5c8)
[413775.644774] [<80332f64>] (tty_open) from [<80143c3c>] (chrdev_open+0xb0/0x188)
[413775.644792] [<80143c3c>] (chrdev_open) from [<8013d620>] (do_dentry_open.isra.15+0xfc/0x314)
[413775.644809] [<8013d620>] (do_dentry_open.isra.15) from [<8013d8d4>] (vfs_open+0x54/0x58)
[413775.644827] [<8013d8d4>] (vfs_open) from [<8014b14c>] (do_last.isra.51+0x124/0xc8c)
[413775.644845] [<8014b14c>] (do_last.isra.51) from [<8014d7e0>] (path_openat+0x338/0x5a0)
[413775.644861] [<8014d7e0>] (path_openat) from [<8014e938>] (do_filp_open+0x3c/0x90)
[413775.644877] [<8014e938>] (do_filp_open) from [<8013e928>] (do_sys_open+0x10c/0x1dc)
[413775.644895] [<8013e928>] (do_sys_open) from [<8013ea24>] (SyS_open+0x2c/0x30)
[413775.644912] [<8013ea24>] (SyS_open) from [<8000eb40>] (ret_fast_syscall+0x0/0x54)
[413775.644921] ---[ end trace 0dd060d51e7292bc ]---

When I connect my Codebug running the serial tether CBG.

/dev/ttyACM0 appears but I can't open it with pyserial or minicom.

Set leg output state

I don't seem able to set a leg's output state :(
I've tried this code but either I've mis-understood the cb.set_output function or it doesn't work
Help please :)

import os
import sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)

from codebug_tether import CodeBug
import time


if __name__ == '__main__':
    cb = CodeBug()
    cb.clear()
    for i in range(3):
            cb.set_output(0,True)
            time.sleep(1)
            cb.set_output(0,False)
            time.sleep(1)

How do I wire my Codebug to my Raspberry Pi?

I can see how the code gets installed, I can get the cbg file installed on my Codebug all from my Raspberry Pi (it appears as /dev/sda1 when I hold button A and plug it in). But, the missing piece is how to wire RPi pins #8 (TXD), #10 (RXD) & #6 (GND) to my Codebug.

Or if I use a FTDI USB serial how to wire TXD, RXD and GND to the Codebug.

Do I need to be worried about 3V3 vs 5V0?

I've got the same issue with your I2C tethering.

Control of CodeBug LEG state not working as expected

Test case:
PS C:\Users\David\Documents\GitHub\codebug_tether> python
ActivePython 2.7.6.9 (ActiveState Software Inc.) based on
Python 2.7.6 (default, Feb 27 2014, 14:15:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from codebug_tether import CodeBug
cb = CodeBug('com6')
cb.set_leg_io(0, 0)
cb.set_output(0,1)
cb.set_leg_io(1, 0)
cb.set_output(1,1)
cb.set_leg_io(2, 0)
cb.set_output(2,1)
exit()
PS C:\Users\David\Documents\GitHub\codebug_tether>

The effect of this is that each of the 3 Legs is set HIGH in turn, but is reset to LOW when the next Leg in the sequence is set HIGH, so at the end of the test only Leg2 is High.

I expected each Leg to be set/cleared independently.

Is this a bug, or have I misunderstood the intent of the API? If the latter, is there a simple way to set/reset each Leg independently please?

[This is using version = '0.4.1' of the codebug_tether module and associated .cbg firmware.]

installation.rst for Linux omission

Additional package which must be installed for tethering to work:
python3-serial

E.g. on Debian-type systems: sudo apt-get install python3-serial

macOS issue -- ImportError: No module named 'serial'

The install instructions which are in readthedocs (and also on CodeBug's Activities) are missing a crucial library that doesn't come installed in vanilla python (at least not on the Mac)

pyserial

Here's what happens on a brand new python virtualenv:

(hax) mjl@milo:codebug$ python
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import codebug_tether
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mjl/lib/hax/lib/python3.5/site-packages/codebug_tether/__init__.py", line 1, in <module>
    from codebug_tether.core import (CodeBug,
  File "/Users/mjl/lib/hax/lib/python3.5/site-packages/codebug_tether/core.py", line 3, in <module>
    import serial
ImportError: No module named 'serial'
>>>

If the instructions are updated to add pyserial as well as codebug_tether (or set it as a dependency for the package) then it will solve for other kids playing along:

pip install codebug_tether pyserial

Then it works.

Let's try:

(hax) mjl@milo:codebug$ pip install pyserial
Collecting pyserial
  Downloading pyserial-3.2.1-py2.py3-none-any.whl (189kB)
    100% |████████████████████████████████| 194kB 967kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.2.1

Now import the module:

(hax) mjl@milo:codebug$ python
Python 3.5.2 (default, Jul 28 2016, 21:28:00)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import codebug_tether
>>>

Happy Hacking!

SerialException: Could not open port /dev/ttyS0 [Errno 13] Permission denied: '/dev/ttyS0'

Picture of the issue: https://twitter.com/sezzyann72/status/739477225637052416

It looks like permissions on /dev/ttyS0 are not set up correctly. When you type:

ls -l /dev/ttyS0

You should get the following readout:

crw-rw---- 1 root dialout 4, 64 Jun  6 10:56 /dev/ttyS0

Also,

groups

should return:

pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

The important group to have is dialout.

This error can usually be fixed with:

sudo apt-get update
sudo apt-get upgrade

I'm opening this issue for discussion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.