Commit dcf44734 authored by Hermann Mayer's avatar Hermann Mayer

[Docs] Added a initial readme file with a project logo asset.

parent 5c802006
![avm-trigger-daemon](docs/assets/logo-project.png)
/*
* Copyright (c) 2015 Hermann Mayer
*
* AVM - Interface the Smart Home solutions
*
* This file is part of avm-motion-trigger.
*
* avm-motion-trigger is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* avm-motion-trigger is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with avm-motion-trigger. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pir-motion.h"
/*
* Copyright (c) 2015 Hermann Mayer
*
* AVM - Interface the Smart Home solutions
*
* This file is part of avm-motion-trigger.
*
* avm-motion-trigger is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* avm-motion-trigger is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with avm-motion-trigger. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SENSORS_PIR_MOTION_H
#define SENSORS_PIR_MOTION_H
#include <bcm2835.h>
#endif
#include <bcm2835.h>
#include <stdio.h>
#include <time.h>
// RPi Plug P1 pin 11 (which is GPIO pin 17)
#define PIN RPI_GPIO_P1_11
int main(void)
{
if (!bcm2835_init()) {
return 1;
}
// Set PIN to be an input
bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_INPT);
// with a pulldown
bcm2835_gpio_set_pud(PIN, BCM2835_GPIO_PUD_DOWN);
// And a rising edge detect enable
bcm2835_gpio_aren(PIN);
while (1) {
if (bcm2835_gpio_eds(PIN)) {
// Now clear the eds flag by setting it to 1
bcm2835_gpio_set_eds(PIN);
printf("[%u] Detected a motion!\n", (unsigned)time(NULL));
}
// wait a bit
delay(500);
}
bcm2835_close();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment