Page 1 of 1

Python Programming and GUI's

PostPosted: Sat Aug 05, 2017 11:13 am
by pesdabrian
Just bought Python Programming and GUIs book, I can't find the CD download image on Elektor.com. Anybody know where the download link is?

Re: Python Programming and GUI's

PostPosted: Tue Aug 08, 2017 3:20 pm
by pesdabrian
Found it!
at https://www.elektor.com/python-programming-and-guis
bottom of page, Attachments and Downloads.

Re: Python Programming and GUI's

PostPosted: Sun Aug 05, 2018 9:04 pm
by dshepherd
I've ran into a snag at Chapter 5 The Arduino Uno as a Slave
Specifically at Program 5-1 Use check buttons to select state of output
I'm unable to get prog_05_01.py "Write Digital Outputs" to toggle the 4 LEDs I have wired up to digital output pins 2,3,4,5.
If I execute prog_05_01.py in a terminal , clicking write gives the output:
(repeats 5 times ex tries 0-4)
"Incorrect address or project number for slave, project = 1 address = 1
failed to connect"
I never see tx/rx leds on Uno blinking

I have:
.. loaded slave.hex correctly (no error in log,)
.. set up user pi as a member of dialup group
.. fitted 10uf electrolytic capacitor between reset and ground
.. set slave address = 1, project = 1

My hw/sw setup is:

#1 Raspberry Pi 3b v1.2 ~2015,
OS:Raspbian Linux raspberrypi 4.9.41v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv1 GNU/Linux
utilities: python3-serial 3.2.1-1, avrdude 6.3.2+rpi1, python 3.5.3 , incl tkinter

#2 OSEPP Uno R3 Plus ~2016, ATmega328P, (note avrdude detects device signature 0x1e950f, probably m328p )
https://www.osepp.com/electronic-module ... no-r3-plus

Re: Python Programming and GUI's

PostPosted: Mon Aug 06, 2018 11:48 pm
by dshepherd
Can't make USB serial connection to OSEPP Uno R3

Postby dshepherd ยป Sun Aug 05, 2018 4:53 pm

Can't make USB serial connection to OSEPP Uno R3
also posted in Courses / Python Programming and GUI's
ref: https://www.elektor.com/python-3-programming-and-guis

I've ran into a snag at Chapter 5 The Arduino Uno as a Slave
Specifically at Program 5-1 Use check buttons to select state of output
I'm unable to get prog_05_01.py "Write Digital Outputs" to toggle the 4 LEDs I have wired up to

digital output pins 2,3,4,5.
If I execute prog_05_01.py in a terminal , clicking write gives the output:
(repeats 5 times ex tries 0-4)
"Incorrect address or project number for slave, project = 1 address = 1
failed to connect"
I never see tx/rx leds on Uno blinking

I have:
.. loaded slave.hex correctly (no error in log,)
.. set up user pi as a member of dialup group
.. fitted 10uf electrolytic capacitor between reset and ground
.. set slave address = 1, project = 1

My hw/sw setup is:

#1 Raspberry Pi 3b v1.2 ~2015,
OS:Raspbian Linux raspberrypi 4.9.41v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv1 GNU/Linux
utilities: python3-serial 3.2.1-1, avrdude 6.3.2+rpi1, python 3.5.3 , incl tkinter

#2 OSEPP Uno R3 Plus ~2016, ATmega328P, (note avrdude detects device signature 0x1e950f, probably
m328p )
https://www.osepp.com/electronic-module ... no-r3-plus
dshepherd Posts: 1Joined: Sun Aug 05, 2018 3:00 pm

Re: Python Programming and GUI's

PostPosted: Wed Aug 15, 2018 11:09 am
by Barnett
Is your hw/sw setup beginner friendly at all, Dshepherd?

Re: Python Programming and GUI's

PostPosted: Sat Sep 01, 2018 2:45 pm
by dshepherd
I'd consider my HW setup a bit more advanced than beginner. The Raspberry Pi and OSEPP UNO I'm using were set up fresh for the course, with no left-over
configuration or setup from other projects. (I am a newbie with Arduino and Python though).
I've got more Raspberry Pi experience, and worked in various areas of Electronics for over 25 years.
I do have a dual trace oscilloscope, but no logic analyser etc., so I'm trying to eliminate simple possibilities.

I have been able to blink the LED on the 'Uno by sending bytes to it using the debugging tips here:
https://www.meirobot.com/single-post/RPiUSBArduino

ex. Note hex notation I was using ( ser.write(b'\x41') or ser.write(b'\0x43')) ,
BUT the RX led blinked when I sent these to OSEPP_Uno_R3_Plus running sketch from meirobot
example:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "copyright", "credits" or "license()" for more information.
>>> import serial
>>> ser = serial.Serial('/dev/ttyUSB0',9600)
>>> ser.write(b'\x41'

Re: Python Programming and GUI's

PostPosted: Tue Oct 23, 2018 11:13 am
by alina21
Hey Everyone,

If you get any error while coding you can take help from Python Tutorial. This tutorial will help you in building your concepts as well as understanding.

Thanks

Re: Python Programming and GUI's

PostPosted: Sun Nov 11, 2018 1:31 pm
by dshepherd
Success! (Thanks for your troubleshooting advice Andrew Pratt!)

Root cause:
In my Raspberry Pi 3b environment the Arduino Uno USB connection is seen at /dev/tttyUSB0

To fix Rasp Pi Serial comm problems with prog_05_01.py, prog_05_02.py and others
USE THIS FOR Rasp Pi ...

Note: Don't type in the line numbers, they're for reference only: ex. 85-89

In
/home/pi/programs/chap05_progs
uno_slave.py

change line# 88 to

if fl[3:6] == 'USB':

ex.
class Uno
connect(Self)

85 acms = []
86 file_list = os.listdir('/dev')
87 for fl in file_list:
88 if fl[3:6] == 'USB':
89 acms.append(fl)