Giter VIP home page Giter VIP logo

parent-detector's People

Contributors

aldreth avatar bennuttall avatar davidhoness avatar deejay avatar glenpike avatar grega avatar lauraclay avatar lornalynch avatar marcscott avatar missphilbin avatar sra405 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parent-detector's Issues

'shebang' lines missing from displayed code samples

from http://www.raspberrypi.org/forums/viewtopic.php?f=79&t=78503

The code samples displayed at http://www.raspberrypi.org/learning/parent-detector/ do not have 'shebang' lines to invoke the python interpreter. Thus trying to run the code via ./pirtest.py as documented results in the script being passed to the shell, which fails.

(I note that the code stored on github does have these prefix lines, so this might be a more general formatting error?)

Terminology

I do not wish to be pedantic but some of the terminology used in this worksheet is incorrect:

The OUT / output of the sensor is refers to a "sensor pin" rather than the "output of the sensor" or "Sensor Output"

More importantly still, the worksheet states that "This sensor pin will receive power whenever motion is detected by the PIR module." This is misleading on several counts. This pin is an output so it doesn't receive anything. The word power is also wrong. This pin outputs a voltage representing logic level 1 to signal that motion has been detected.

When motion detected, it's triggered many times.

Hello all,

i'm trying to set up the parent detector without the camera but only writing down the time. Everytime motion is detected I write the current time to the console using datetime. But when there is motion it prints it like 20 times from 1 motion. When using time.sleep(1) it reduces it to 4 times writing it to the console. When using time.sleep(5) I got 1 log to the console but it's not able to write it every 5 seconds, it does it every 15 or so. So my question is, how can I get a accurate motion detection without printing multiple logs for a movement that happend in 1 second. My current code looks like this :

import datetime
from gpiozero import MotionSensor

pir = MotionSensor(4)
while True:
    if pir.motion_detected:
        print(datetime.datetime.now())
        print("Motion detected!")
        time.sleep(x) # high value for x = lower message per simple movement = 3*x time before it can detect new movement.

thanks!

feedback from projects site

"URL: /en/projects/parent-detector/7 tried following the parent-detector.py script, and it spends too much time teaching how to do individual things, but gives no indication how to implement them into the code and doesn't give the full final code at the end to see how it should look."

Should we include a link to the completed project?

Word-wrap issue with code formatting on website

On http://www.raspberrypi.org/learning/parent-detector/ because the page has been formatted as fixed-width, the code print "GPIO pin {0} is {1}".format(sensorPin, "HIGH" if currState else "LOW") has actually been split over two lines:

print "GPIO pin {0} is {1}".format(sensorPin, "HIGH"
if currState else "LOW")

which makes it look like the final if is outside of the while loop.
It could be simply rewritten as:

if currState:
    newstate = "HIGH"
else
    newstate = "LOW"
print "GPIO pin {0} is {1}".format(sensorPin, newstate)

but it looks as if even that might word-wrap? :-/

When LinuxFormat magazine includes code in their tutorials, they use a solid background colour to indicate code that should all be on one line when typed out, and whitespace between lines of code that should be on separate lines when typed out. Dunno if or how you'd do something like that in Markdown though - maybe a bit of clever CSS styling when you convert it to HTML?

Update to use GPIO Zero

Lots of teachers find this resource at Picademy and end up copying out the RPi.GPIO code. It would be much simpler with GPIO Zero :)

Also see #8 Update to use IDLE rather than nano.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.