Go to advanced search

by gordon77
Sun Feb 17, 2019 6:22 pm
Forum: Camera board
Topic: Fake Camera ?
Replies: 2
Views: 104

Re: Fake Camera ?

Looks genuine to me but the camera mount does look very thick compared to those l've seen, hence the unparallelled mounting.
by gordon77
Fri Feb 15, 2019 8:18 pm
Forum: General discussion
Topic: PiZero GPIO Pin Issues
Replies: 20
Views: 321

Re: PiZero GPIO Pin Issues

If l press and hold on the picture links it allows me to download them to my tablet.
by gordon77
Fri Feb 15, 2019 7:33 pm
Forum: General discussion
Topic: PiZero GPIO Pin Issues
Replies: 20
Views: 321

Re: PiZero GPIO Pin Issues

I'm afraid you may find it a lot harder to get the header off than on. I would heat and pull each pin in turn if you can, and then clean out the holes.
I'd try finding the fault in preference to removing the header.
by gordon77
Fri Feb 15, 2019 6:15 pm
Forum: General discussion
Topic: PiZero GPIO Pin Issues
Replies: 20
Views: 321

Re: PiZero GPIO Pin Issues

The soldering looks very tidy. Do you think any are 'dry' joints?
by gordon77
Fri Feb 15, 2019 5:51 pm
Forum: General discussion
Topic: PiZero GPIO Pin Issues
Replies: 20
Views: 321

Re: PiZero GPIO Pin Issues

Can you show us a photo of the soldering?
by gordon77
Fri Feb 15, 2019 8:55 am
Forum: Python
Topic: play random wav file at each GPIO trigger
Replies: 1
Views: 40

Re: play random wav file at each GPIO trigger

try this... #!/usr/bin/env python3 from gpiozero import Button import pygame import glob import random from time import sleep sampleplay = Button(3) soundfiles = glob.glob("/home/pi/audiotrigger/samples/*.wav") pygame.init() pygame.mixer.init() while True: sampleplay.wait_for_press() sample = pygame...
by gordon77
Thu Feb 14, 2019 9:50 pm
Forum: Python
Topic: Problem with variables
Replies: 2
Views: 95

Re: Problem with variables

What about just newest, no quotes marks etc?

attached = { "attachment": (newest, open(newest, "rb"), "image/jpeg") }
by gordon77
Wed Feb 13, 2019 3:29 pm
Forum: Beginners
Topic: A basic setup that randomly turns on a light for a random time.
Replies: 8
Views: 160

Re: A basic setup that randomly turns on a light for a random time.

pfletch101 wrote:
Wed Feb 13, 2019 3:18 pm
If that's all you want, you would better off buying a dedicated plugin switch with this functionality, e.g. https://www.amazon.com/GE-50462-7-Day-R ... B0002U3Y0Q.
It appears not very random according to the reviews.
by gordon77
Wed Feb 13, 2019 10:14 am
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

If it helps this version will detect how many fields there are in the csv.txt file and adjust accordingly. csv.txt must also contain the titles in the first row. To add more items just add to each line, after a comma. 1,2,3,4,5,Number :,Name :,Tel No :,Test : 77, 106, 39, 242, 242,A44B,Smith,+44 765...
by gordon77
Tue Feb 12, 2019 8:12 pm
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

You'll also need to change

data.append(line[5:8])

To

data.append(line[5:9])

AND

line = csv[count].split(',',8)

To


line = csv[count].split(',',9)

And add the extra data to csv.txt
by gordon77
Tue Feb 12, 2019 7:19 pm
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

Remove the line GPIO.setmode (GPIO.BCM) near the beginning.
by gordon77
Tue Feb 12, 2019 6:27 pm
Forum: General discussion
Topic: 5v relay 1=0, 0=1?
Replies: 5
Views: 177

Re: 5v relay 1=0, 0=1?

Most of these boards are active low as you have found. You can't change it, unless you want to modify the circuitry or add an interface.
by gordon77
Tue Feb 12, 2019 12:16 pm
Forum: General programming discussion
Topic: OpenCV: printing live time countdown on a video display
Replies: 1
Views: 68

Re: OpenCV: printing live time countdown on a video display

try cv2.putText(frame,"Duration : " + time_left, (10, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0)) Without all your code it's hard to see how this fits in. It seems to me calling this will stop everything else while it simply counts 10 seconds. if it helps I've added the count to the script we m...
by gordon77
Mon Feb 11, 2019 9:23 am
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

This version should work with just a simple text file... 77, 106, 39, 242, 242,A44B,Smith,+44 7654 123456 237, 30, 40, 160, 123,U13Z,Jones,+44 7777 654321 2019-02-11 09:10:07 Access Granted >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Number: U13Z Name: Jones Tel No: +44 7777 654321 #!/usr/bin/env python #...
by gordon77
Sun Feb 10, 2019 7:47 pm
Forum: Python
Topic: What does "from . import *" mean.
Replies: 6
Views: 200

Re: What does "from . import *" mean.

A Google shows it's relative, see guido's decision in this link...

https://www.python.org/dev/peps/pep-0328/
by gordon77
Fri Feb 08, 2019 5:51 pm
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

Try this, as it's reading strings back not integers
csv = []
with open("csv.txt", "r") as file:
line = file.readline().strip()
csv = line.split(',',5)
my_uid= list(map(int, csv))
by gordon77
Fri Feb 08, 2019 5:06 pm
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

The new section is one space left, you need to align it with the other lines.
by gordon77
Fri Feb 08, 2019 4:52 pm
Forum: Python
Topic: Read from CSV to part of my code (attached)
Replies: 31
Views: 416

Re: Read from CSV to part of my code (attached)

write a file called csv.txt containing your values eg 77,106,39,242,242

Code: Select all

csvline = "34,56,78,90,120"
with open("csv.txt", "w") as file:
    file.write(csvline)
then read it

Code: Select all

csv = []
with open("csv.txt", "r") as file:
    line = file.readline().strip()
    csv = line.split(',',5)

print (csv)

Go to advanced search