kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

codebug tether python3 commands

Tue Jun 14, 2016 7:48 pm

hello,

why are the next commands not working in python3 for the codebug

cb.clear()
cb.set_pixel
cb.set_col

the only things that is working

cb.set_row

see pdf manual: https://media.readthedocs.org/pdf/codeb ... tether.pdf

kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

Re: codebug tether python3 commands

Tue Jun 14, 2016 7:54 pm

i forgot to attach the script python3 raspberry

import time
import codebug_tether

cb = codebug_tether.CodeBug()

cb.set_row(3,0b10101)
time.sleep(1)
cb.set_row(3,0b10001)
time.sleep(1)

#cb.clear()
#time.sleep(1)
#cb.set_pixel(2, 2,1)
#time.sleep(1)
cb.set_col(0,0x1f)

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: codebug tether python3 commands

Tue Jun 14, 2016 8:04 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

Re: codebug tether python3 commands

Tue Jun 14, 2016 8:22 pm

I am using usb connection. No i2c connection....
The set-row are working, all the rest not...

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: codebug tether python3 commands

Tue Jun 14, 2016 8:58 pm

Just for clarification: in the sample code you have posted the cb.clear and cb.set_pixel calls are commented out with the # at the beginning of the line. Is that the way you are testing?

kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

Re: codebug tether python3 commands

Wed Jun 15, 2016 4:48 am

In the script, when i tested it, i removed the # on these line. Resulting in error when running... Only the cb.row are active in the script

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: codebug tether python3 commands

Wed Jun 15, 2016 8:25 am

kurtwerbrouck wrote:In the script, when i tested it, i removed the # on these line. Resulting in error when running...

In your original post you said the lines now commented out were 'not working'. In this message you say 'Resulting in error'

If it results in an error, what is the error message? (Error messages are normally there to tell you what the system has detected as being wrong - you may simply need help to interpret the message.)

Have you downloaded and 'flashed' a current version of codebug_tether.cbg to your codebug? Maybe the 'firmware' running on the codebug needs correspond with the commands you are using in the script.

kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

Re: codebug tether python3 commands

Wed Jun 15, 2016 3:54 pm

hello,

see error message:

Traceback (most recent call last):
File "/home/pi/kurt/codebug.py", line 15, in <module>
cb.set_col(1,0x1f)
File "/usr/lib/python3/dist-packages/codebug_tether/core.py", line 272, in set_col
self.set_bulk(0, bytes(rows))
File "/usr/lib/python3/dist-packages/codebug_tether/serial_channel_device.py", line 114, in set_bulk
len(values)) + bytes((values,)))
TypeError: 'bytes' object cannot be interpreted as an integer

script: line 15 is the bottom command in the script
import time
import codebug_tether

cb = codebug_tether.CodeBug()

cb.set_row(3,0b10101)
time.sleep(1)
cb.set_row(3,0b10001)
time.sleep(1)

#cb.clear()
#time.sleep(1)
#cb.set_pixel(2, 2,1)
#time.sleep(1)
cb.set_col(1,0x1f)

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: codebug tether python3 commands

Thu Jun 16, 2016 6:05 pm

Are you trying to run a python2 script with python3?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

kurtwerbrouck
Posts: 18
Joined: Sun Mar 27, 2016 7:02 pm

Re: codebug tether python3 commands

Thu Jun 16, 2016 7:14 pm

nope, only python 3 scripts

but now everything is working... did change anything...very bizar
I wrote next script on python windows and then ftp it to raspi 3 and the raspi zero...

import codebug_tether
import codebug_tether.sprites
import time
cb = codebug_tether.CodeBug()
cb.clear()
time.sleep(1)
cb.clear()
displaytekst = ' BEL-IRL: 2 - 20'
msg = codebug_tether.sprites.StringSprite(displaytekst)
while True:
for x in range( 0 , (5*len(displaytekst))):
cb.draw_sprite((-1*x),0,msg)
time.sleep(.07)
time.sleep(.5)

Works perfect now,

Thanks

Return to “HATs and other add-ons”