Page 1 of 1

codebug tether python3 commands

Posted: Tue Jun 14, 2016 7:48 pm
by kurtwerbrouck
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

Re: codebug tether python3 commands

Posted: Tue Jun 14, 2016 7:54 pm
by kurtwerbrouck
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)

Re: codebug tether python3 commands

Posted: Tue Jun 14, 2016 8:04 pm
by DougieLawson

Re: codebug tether python3 commands

Posted: Tue Jun 14, 2016 8:22 pm
by kurtwerbrouck
I am using usb connection. No i2c connection....
The set-row are working, all the rest not...

Re: codebug tether python3 commands

Posted: Tue Jun 14, 2016 8:58 pm
by B.Goode
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?

Re: codebug tether python3 commands

Posted: Wed Jun 15, 2016 4:48 am
by kurtwerbrouck
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

Re: codebug tether python3 commands

Posted: Wed Jun 15, 2016 8:25 am
by B.Goode
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.

Re: codebug tether python3 commands

Posted: Wed Jun 15, 2016 3:54 pm
by kurtwerbrouck
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)

Re: codebug tether python3 commands

Posted: Thu Jun 16, 2016 6:05 pm
by DougieLawson
Are you trying to run a python2 script with python3?

Re: codebug tether python3 commands

Posted: Thu Jun 16, 2016 7:14 pm
by kurtwerbrouck
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