Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie with Pi3
#44
(Apr-04-2018, 07:40 AM)Dualxeon Wrote: When I start script I have the door open(no real door) photocell led on for open, door open switch set to open (on).
In this case shouldn't you setup the switch 11 to PUD_UP?, e.g.
GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_UP)

from wiki - - https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
Quote:Pull up / Pull down resistors

If you do not have the input pin connected to anything, it will 'float'. In other words, the value that is read in is undefined because it is not connected to anything until you press a button or switch. It will probably change value a lot as a result of receiving mains interference.

To get round this, we use a pull up or a pull down resistor. In this way, the default value of the input can be set. It is possible to have pull up/down resistors in hardware and using software. In hardware, a 10K resistor between the input channel and 3.3V (pull-up) or 0V (pull-down) is commonly used. The RPi.GPIO module allows you to configure the Broadcom SOC to do this in software:

GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# or
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

(where channel is the channel number based on the numbering system you have specified - BOARD or BCM).

Maybe I'm not correct - not sure
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Newbie with Pi3 - by Dualxeon - Mar-30-2018, 08:39 AM
RE: Newbie with Pi3 - by buran - Mar-30-2018, 09:32 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-30-2018, 10:26 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-30-2018, 10:19 PM
RE: Newbie with Pi3 - by snippsat - Mar-30-2018, 10:38 PM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 05:53 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-31-2018, 08:28 AM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 08:48 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-31-2018, 09:25 AM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 10:00 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-31-2018, 10:28 AM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 10:47 AM
RE: Newbie with Pi3 - by Dualxeon - Mar-31-2018, 12:09 PM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 12:23 PM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 07:29 PM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 07:47 PM
RE: Newbie with Pi3 - by Dualxeon - Mar-31-2018, 08:55 PM
RE: Newbie with Pi3 - by buran - Mar-31-2018, 09:13 PM
RE: Newbie with Pi3 - by Dualxeon - Apr-01-2018, 08:51 AM
RE: Newbie with Pi3 - by wavic - Apr-01-2018, 09:07 AM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 08:57 AM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 09:13 AM
RE: Newbie with Pi3 - by wavic - Apr-03-2018, 09:47 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-01-2018, 09:14 AM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 09:27 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-01-2018, 09:36 AM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 09:40 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-01-2018, 11:34 AM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 12:14 PM
RE: Newbie with Pi3 - by Dualxeon - Apr-01-2018, 06:32 PM
RE: Newbie with Pi3 - by buran - Apr-01-2018, 08:08 PM
RE: Newbie with Pi3 - by Dualxeon - Apr-02-2018, 10:19 AM
RE: Newbie with Pi3 - by buran - Apr-02-2018, 11:13 AM
RE: Newbie with Pi3 - by buran - Apr-02-2018, 11:20 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-03-2018, 07:33 AM
RE: Newbie with Pi3 - by buran - Apr-03-2018, 07:41 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-03-2018, 08:46 AM
RE: Newbie with Pi3 - by buran - Apr-03-2018, 08:56 AM
RE: Newbie with Pi3 - by buran - Apr-03-2018, 09:01 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-03-2018, 09:17 AM
RE: Newbie with Pi3 - by buran - Apr-03-2018, 10:14 AM
RE: Newbie with Pi3 - by buran - Apr-03-2018, 11:04 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-04-2018, 07:40 AM
RE: Newbie with Pi3 - by buran - Apr-04-2018, 08:02 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-04-2018, 08:30 AM
RE: Newbie with Pi3 - by buran - Apr-04-2018, 09:08 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-04-2018, 09:15 AM
RE: Newbie with Pi3 - by buran - Apr-04-2018, 09:22 AM
RE: Newbie with Pi3 - by Dualxeon - Apr-04-2018, 08:14 PM
RE: Newbie with Pi3 - by buran - Apr-04-2018, 08:21 PM
RE: Newbie with Pi3 - by Dualxeon - Apr-04-2018, 10:58 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020