WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: python-RPi.GPIO.tcz lost ??  (Read 3798 times)

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
python-RPi.GPIO.tcz lost ??
« on: September 28, 2020, 04:46:24 AM »
hello ,
on version 11 the package python-RPi.GPIO.tcz is lost ?
is it replaced by another?

thank you
bellad.flnet.org

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: python-RPi.GPIO.tcz lost ??
« Reply #1 on: September 28, 2020, 04:54:33 AM »
You can try downloading it manually from the piCore-9.x repo to see if it will work with piCore-11.x

Offline bellad

  • Jr. Member
  • **
  • Posts: 65
Re: python-RPi.GPIO.tcz lost ??
« Reply #2 on: September 28, 2020, 05:23:20 AM »
ok , thank , but no work with python 3.8 , i install python 2.7
bellad.flnet.org

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: python-RPi.GPIO.tcz lost ??
« Reply #3 on: September 28, 2020, 05:51:34 AM »
python-RPi.GPIO copied over and dep file adjusted

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #4 on: October 01, 2020, 07:48:22 AM »
OK this is my first TC post
The TC team are to be congratulated on a remarkable creation. I have been an engineer and designer in the electronics/OA/PC industry since before the PC existed and as such there are few creations that I would give the same accolade to.

OK now for the meat.
I need some help in that I would like to toggle a few RPi I/O pins (and maybe get I2C working) with TC straight out of the box (RPI+PiCore11).
I have persevered over several weeks to get various aspects setup (ie UK keyboard etc) and to try and understand TC.
I have downloaded Python 3.8 and got communications (ssh on RL8152B) going with an original RPi B and a new RPi zero. I have even got Python3.8 to talk to two USB-serial ports [ CP2104 and CH304] with Tx and Rx looped back but, for the life of me, I cannot seem to find out how to toggle an RPi I/O pin. Python and microPython are both new to me (all though I first heard of Python in 1994 on a bus traveling from Taipei  to Hsinchu, Taiwan)
I realise that TC cannot give me a deterministic response as it is a multitasking OS however I just want a simple 500mS pulse within (say) 100mS of the correct temporal flow of the code. (Actually to trigger a 433MHz transmitter to open a door!)
And then I saw that you had

"....python-RPi.GPIO copied over and dep file adjusted"

Hurray I thought  so I downloaded it but I still go the error

Code: [Select]
Traceback (most recent call last):
  File "py02.py", line 8, in <module>
    import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'
:-\

[PY02.py just being a simple mod to my serial port test]

Then I discover that it looks like it is only for Python 2.7 but I am running 3.8

Sooooo ......

How do I get it to work with 3.8?

Gosh this TC+Python is hard work for an oldie newbie; any help and guidance would be gratefully received.

    [EDIT]: Added code tags.  Rich
« Last Edit: October 01, 2020, 08:43:11 AM by Rich »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: python-RPi.GPIO.tcz lost ??
« Reply #5 on: October 01, 2020, 08:24:31 AM »
python3.8-rpi-gpio posted (not tested)
« Last Edit: October 01, 2020, 08:30:11 AM by Juanito »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11514
Re: python-RPi.GPIO.tcz lost ??
« Reply #6 on: October 01, 2020, 08:45:08 AM »
Hi CharlieDelta
Welcome to the forum.

Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly.

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #7 on: October 01, 2020, 09:33:18 AM »
Ooops sorry !
Is this correct?
Code: [Select]
tc@box:~$  python3 py02.py
Traceback (most recent call last):
  File "py02.py", line 8, in <module>
    import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'

Forgive my learning curve
CD

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11514
Re: python-RPi.GPIO.tcz lost ??
« Reply #8 on: October 01, 2020, 09:42:47 AM »
Hi CharlieDelta
Ooops sorry ! ...
Not a problem.

Quote
... Is this correct? ...
Yes it is. Don't worry about the  newbielink  label that's there. It will automatically go away after you make a few more posts.

Quote
... Forgive my learning curve
None of us were born with the knowledge we have. We acquired it over time.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14754
Re: python-RPi.GPIO.tcz lost ??
« Reply #9 on: October 01, 2020, 09:54:17 AM »
'seems to work for me:
Code: [Select]
$ tce-load -i python3.8-rpi-gpio
$ python3.8
>>> import sys
>>> import RPi.GPIO as GPIO
>>>

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11026
Re: python-RPi.GPIO.tcz lost ??
« Reply #10 on: October 01, 2020, 12:46:12 PM »
You don't have to use python; bare shell or C should both be easier and faster. Many examples at:
https://elinux.org/RPi_GPIO_Code_Samples#sysfs.2C_part_of_the_raspbian_operating_system
The only barriers that can stop you are the ones you create yourself.

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #11 on: October 01, 2020, 02:23:42 PM »
Thanks Juanito and Curaga
 

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #12 on: October 15, 2020, 08:34:37 AM »
Gentleman
I appreciate your knowledge and support and as such I would like to make my own (albeit small) contribution to this fine community. I hope that it is of some help to other newbies.

I have attached 'scope outputs to this message that show the following simple code functioning and you can see they exemplify the non real time nature of the code.

The 'scope was attached to a loopback link on the serial port ttyUSB0 between Tx and Rx. The serial port was connected to the RPi 1B (2012) via a 4 port USB2.0 hub. The USB/Serial module was base on a CH341 chip. Interestingly no matter how many times I run the code the 'scope always registers 800 edges (ie 400 loops) however the odd large (relatively!) delays are always randomly(?) positioned.
When viewing the images you need to wind the magnification up to see the finer edges. These images were obtained using 10 million samples hence the irregular shape of the edges.
Anyway hope that this may help someone sometime.

Some of this code was taken from some source that I cannot regretfully  attribute due to memory failure ! [DDR 0.1 is well obsolete]


Code: [Select]
#!/usr/bin/env python3.8
#WOW this works

import time
import serial

 #configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
    port='/dev/ttyUSB0',
    #port='Com8',
    baudrate=9600,
    parity=serial.PARITY_ODD,
    stopbits=serial.STOPBITS_TWO,
    bytesize=serial.SEVENBITS
)


s="--"

ser.isOpen()

print ('Enter your commands below.\r\nInsert "exit" to leave the application.')
while 1 :
    # get keyboard input

    s = input(">pp> ")
    if s == 'exit':
        ser.close()
        exit()
    else:
        # send the character to the device
        ser.write(s.encode())
        out=""
        #  wait one second before reading output (let's give device time to answer)
        time.sleep(1)
        while ser.inWaiting() > 0:           
            out += ser.read(1).decode()
        if out != '':
            print (out)


PS It seems that I can only load one image due to size restrictions and even then I have had to change to grayscale and much lower resolution.

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #13 on: October 15, 2020, 11:47:11 AM »
Oooooooooops not again. Ignore the last post as I have muddled up two lines of investigation so that the last post is meaningless. I will re do it and repost.
Very red faced  :( Charlie Delta

Offline CharlieDelta

  • Newbie
  • *
  • Posts: 8
Re: python-RPi.GPIO.tcz lost ??
« Reply #14 on: October 15, 2020, 12:03:06 PM »
Gentleman
Correct post this time :D
I appreciate your knowledge and support and as such I would like to make my own
(albeit small) contribution to this fine community. I hope that it is of some help
to other newbies.

I have attached 'scope output to this message that show the following simple code
functioning and you can see they exemplify the non real time nature of the code.

The 'scope was attached to a RPi 1B J1/pin8. Interestingly no matter how
many times I run the code the 'scope always registers 800 edges (ie 400 loops)
however the odd large (relatively!) delays are always randomly(?) positioned.
When viewing the images you need to wind the magnification up to see the finer
edges. These images were obtained using 10 million samples hence the irregular
shape of the edges (due to image compression).
Anyway hope that this may help someone sometime.

Some of this code was taken from some source that I cannot regretfully  attribute
due to memory failure ! [DDR 0.1 is well obsolete]


Code: [Select]
import RPi.GPIO as GPIO
import time
#blink_interval commented out just to see how fast it will all go
# Configure the PIN # 8
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8, GPIO.OUT)
GPIO.setwarnings(False)

# Blink Parameters
#blink_interval = .05 #Time interval in Seconds
blink_Count = 400

# Blinker Loop
for i in range(0,blink_Count):
 GPIO.output(8, True)
 #time.sleep(blink_interval)
 GPIO.output(8, False)
 #time.sleep(blink_interval)

# Release Resources
GPIO.cleanup()
print("Done")


PS It seems that I can only load one image due to size restrictions and even then
I have had to change to grayscale and much lower resolution.