Go to advanced search

by edsulst
Mon Jun 15, 2020 9:57 am
Forum: Beginners
Topic: Use of GPIO pins
Replies: 10
Views: 360

Re: Use of GPIO pins

Thank you all for answering to my question.
It's clear to me now that I can use more pins than I thought.


// Edwin
by edsulst
Sun Jun 14, 2020 7:45 pm
Forum: Beginners
Topic: Use of GPIO pins
Replies: 10
Views: 360

Re: Use of GPIO pins

Sorry, but I forgot to tell you that I have a Raspberry Pi 3 model B V1.2 with a 40 pin header. Now I only used the green colored pins and I wasn't sure if other colors could be used. But if I read the posts correctly it's possible to use the blue, purple and pink also. GREAT !! I did read somewhere...
by edsulst
Sun Jun 14, 2020 5:53 pm
Forum: Beginners
Topic: Use of GPIO pins
Replies: 10
Views: 360

Use of GPIO pins

Hi There, For my project I'm using 17 GPIO pins, but I need one extra. The GPIO pins I'm using are alle the green one's as mentioned here: https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/#prettyPhoto/1/ Is it possible to use another GPIO pin, for example 2, 3, ...
by edsulst
Thu Jun 11, 2020 8:44 pm
Forum: Beginners
Topic: Resistor on output
Replies: 9
Views: 283

Re: Resistor on output

The last code is exactly the same as the first code you posted ?
I can't find anything different.

Wait, I now see the difference: If GPIO.input(7) == 0:

By the way, I now supply 5V to the relayboard by an external 5V power supply instead of the 3.3V of the Raspberry Pi.
by edsulst
Thu Jun 11, 2020 5:04 pm
Forum: Beginners
Topic: Resistor on output
Replies: 9
Views: 283

Re: Resistor on output

When I add: if GPIO(7) == 0: time.sleep(0.1) I got an error: if GPIO(7) == 0: TypeError: 'module' object is not callable. When Google this it seems like I need to import something, but I don't see what. I already import the GPIO with import RPi.GPIO as GPIO Can you tell me what I'm suppose to do her...
by edsulst
Wed Jun 10, 2020 6:22 pm
Forum: Beginners
Topic: Resistor on output
Replies: 9
Views: 283

Re: Resistor on output

No, I did not remove the jumper.
It's still connected to JD-VCC

I put 3.3v (from my Raspberry) on the VCC pin next to the IN1, IN2, etc, and connected the ground to my Raspberry.
by edsulst
Wed Jun 10, 2020 2:38 pm
Forum: Beginners
Topic: Resistor on output
Replies: 9
Views: 283

Re: Resistor on output

Hi pcmanbob I'm using this board: https://www.hobbyelectronica.nl/product/relais-module-8-kanaals-5v/ (sorry the page is in Dutch. I'm not using the 5V pin on the Raspberry, but I'm using the 3.3V pin. All my relays are clicking when I set the output to LOW There are 8 buttons. Every button links to...
by edsulst
Wed Jun 10, 2020 1:00 pm
Forum: Beginners
Topic: Resistor on output
Replies: 9
Views: 283

Resistor on output

Hi there, I have 8 buttons defined as input. (GPIO.IN, pull_up_down=GPIO.PUD_UP) The signal is connected from the button, through a resistor, to the input GPIO pin (pins 7,11,13,15,29,31,33 and 35) Pin numbers 12,16,18,22,32,36,38 and 40 are defined as output (GPIO.OUT). Do I need to add an resistor...
by edsulst
Fri Jun 05, 2020 4:04 pm
Forum: Beginners
Topic: log file access
Replies: 9
Views: 228

Re: log file access

I added it before exit 0

After editing the python script and entered the full path to the logging file it works.

No I have to figure out what I can do about debounces.
When I press the button once, the log tells me that is has pressed 2 or 3 times within the same time.
by edsulst
Fri Jun 05, 2020 2:16 pm
Forum: Beginners
Topic: log file access
Replies: 9
Views: 228

Re: log file access

Sorry, I made a typo.

I've openen the file etc/rc.local and added the following to the end of the file:

Code: Select all

/home/pi/pushbuttons.sh
The python script is in /home/pi/ and that's where i'm reffering to in pushbuttons.sh.
So it seems logic to me that logging.txt has to be created in /home/pi
by edsulst
Fri Jun 05, 2020 1:40 pm
Forum: Beginners
Topic: log file access
Replies: 9
Views: 228

Re: log file access

I'll post my complete python script: #!/usr/bin/env python import RPi.GPIO as GPIO import os import sys from subprocess import Popen import time import logging logging.basicConfig(format='%(asctime)s %(message)s',datefmt='%d-%m-%Y %H:%M:%S', filename='logging.txt',level=logging.DEBUG) def button_sto...
by edsulst
Fri Jun 05, 2020 1:24 pm
Forum: Beginners
Topic: log file access
Replies: 9
Views: 228

Re: log file access

I've added the following code in my Python script: import logging logging.basicConfig(format='%(asctime)s %(message)s',datefmt='%d-%m-%Y %H:%M:%S', filename='logging.txt',level=logging.DEBUG) And in the code that correpond with the buttons, i've added logging.info So it looks like this: #If GPIO(7) ...
by edsulst
Fri Jun 05, 2020 12:06 pm
Forum: Beginners
Topic: log file access
Replies: 9
Views: 228

log file access

Hi there, I searched online, but couldn't find an answer, maybe you can. I have a Python script and from that script I can open several mp4 files with a push of a button. (see: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=276119&p=1673158) So far so good. What I would like to know if its ...
by edsulst
Thu Jun 04, 2020 11:49 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Re: Play video and use a relay

Maybe there is another solution for killing the lights.

When the video is over, the light can go out.
The problem is that I don't know the exact time of each video.
Is it possible to return a status when the video is done en when that status is set, the lights are turn out ?
by edsulst
Thu Jun 04, 2020 10:03 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Re: Play video and use a relay

I stumbled upon that page also. :D

It looks great. To bad there are no screenshots available.
I'll take a look at Pi Presents.

Thanks for you support !!
by edsulst
Thu Jun 04, 2020 9:57 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Re: Play video and use a relay

I ordered the double one.
As I see on the image, the relais use a common ground and 5V.
And with the two other pins I can control the relais.
by edsulst
Thu Jun 04, 2020 9:40 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Re: Play video and use a relay

You are right. I use the wrong numbers. The relays are connected to pin 29 and 30. I have ordered this one: https://www.hobbyelectronica.nl/product/relais-module-1-kanaals-5v/ (sorry, but the page is in Dutch) As I see in the specs it needs 5 volt and pin 2 of the Raspberry would give me 5 volt. If ...
by edsulst
Thu Jun 04, 2020 9:16 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Re: Play video and use a relay

Hi pcmanbob, I want to use 2 relays (for now). I have ordered them, but did not receive them. I want to connect them to pin 14 and 15. This is the code so far (without testing the relay, because I don't have them right now) import RPi.GPIO as GPIO import os import sys from subprocess import Popen GP...
by edsulst
Thu Jun 04, 2020 8:02 am
Forum: Beginners
Topic: Play video and use a relay
Replies: 12
Views: 324

Play video and use a relay

Online I found some code to play a video, with a push on a button. This works great. What I also would like is to use a relay to turn on a lightbulb when the button is pressed. So when the button is pressed, the video will start to play and a light switches on. The light has to turn on for 1 minute....
by edsulst
Sun Nov 17, 2019 6:35 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

It's working now !! Many thanks @pcmanbob There was another error after changing time.sleep(2) I also needed to change the word true in the while. It has to be a capital T according to the error log. My code is now this: while True: Time.sleep(2) After booting to Firefox in full screen I can press t...
by edsulst
Sun Nov 17, 2019 3:42 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

I've changed the code and it doesn't seem to work.

The error I've got in rc-local.out is:

+ hostname -I
+ _IP=
+ [ ]
+ /home/pi/createpic.sh
File "/home/pi/takepic.py", line 33
time sleep(2)
^
SyntaxError: invalid syntax
by edsulst
Sun Nov 17, 2019 2:12 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

This is my complete rc.local file: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By d...
by edsulst
Sun Nov 17, 2019 2:01 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

I've added exec > /tmp/rc-local.out 2>&1;set -x in the rc.local file. And the result of the rc-local.out file is: Traceback (most recent call last): File "/home/pi/takepic.py", line 32, in <module> message = input("Waiting for picture\n\n") # Run until someone presses enter EOFError: EOF when readin...
by edsulst
Sun Nov 17, 2019 1:27 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

Ok, both codes can work. Now the other problem about autostarting the script. When I boot my Raspberry Pi, it start in desktop mode and opens Firefox fullscreen at http://localhost (and shows an image) When I press the button nothing is happening but I want to create a photo with the script and than...
by edsulst
Sun Nov 17, 2019 12:48 pm
Forum: Python
Topic: Push button to make picture
Replies: 12
Views: 515

Re: Push button to make picture

pcmanbob, Even with your code I can't get it to work, so I did some searching and came across this code. This code seems to work. I can add more commands to be execute and this works. Also I only need 2 wires. One to the 3.3V and one to pin 10 to take a picture. In the code above I needed 3 wires. #...

Go to advanced search