@@ -16,32 +16,46 @@ PIR library for Arduino. Supports up to 8 PIR sensors.
1616## Description
1717
1818The PIR library implements a class to monitor 1 or more PIR sensors.
19- The library supports up to 8 PIR sensors per object, which typically are added in ** setup()** .
20- It is possible to add a sensor (pin) multiple times.
21- The library accepts duplicates.
19+ The library supports default 8 PIR sensors per object, which typically are added in ** setup()** .
20+ It is possible to add a sensor (pin) multiple times as the library accepts duplicates.
2221
2322The library has two ** read()** functions, one to read a specific sensor, and one to read all of them.
2423The latter will return a mask indicating HIGH and LOW.
2524The first added PIR will have the LSB.
2625
26+ The maximum number of PIR sensors supported can be adjusted with a define
27+ in the .h file named ** PIR_MAX_COUNT** . The default maximum is 8.
28+
2729Instead of PIR sensors one can add other DigitalOut sensors or even switches.
2830
31+ As always feedback is welcome.
32+
33+ ### Related
34+
35+ - https://github.com/RobTillaart/TCRT5000
36+
2937
3038## Interface
3139
3240``` cpp
3341#include " PIR.h"
3442```
3543
36- #### Base
44+ ### Base
3745
38- - ** PIR()** constructor. Allocated room for 8 PIRs.
46+ - ** PIR()** constructor. Default allocated room for 8 PIRs.
3947- ** uint8_t add(uint8_t pin)** adds a PIR pin to the set of pins.
4048Returns the index or PIR_ARRAY_FULL (0xFE)
41- - ** uint8_t count** returns number of PIR sensors added.
49+ - ** uint8_t add(uint8_t \* pins, uint8_t length)** adds an array of PIR pins
50+ to the set of pins if there is enough room for all pins of the array.
51+ If there is no room in the internal set to add length pins, no pin is added.
52+ Returns the (last) index or PIR_ARRAY_FULL (0xFE) in case no pin is added.
53+ - ** void reset()** removes all pins from the internal set, reset lastRead too.
54+ - ** uint8_t count()** returns number of PIR sensors added.
55+ - ** uint8_t free()** returns number of free slots to add.
4256
4357
44- #### Read
58+ ### Read
4559
4660- ** uint8_t read()** read all PIR sensors in the set.
4761Returns a bit mask of HIGH / LOW values.
@@ -64,16 +78,14 @@ This can improve processing in some cases.
6478
6579- add examples
6680 - interrupts?
81+ - investigate dynamic allocation in constructor (0.3.0)
82+ - 0.2.0 has compile time define.
6783
6884#### Could
6985
70- - investigate PIR16 PIR32 class that can hold more
71- - think MEGA2560.
72- - or dynamic allocation? 0.2.0
73- - one lastRead for all?
74- - ** uint8_t pin(uint8_t index)** to get back configuration
75- - ** bool add(uint8_t array, length)** faster configuration. Return true if there was enough room.
76- - ** clear()** to reset whole object?
86+ - one lastRead for all
87+ - ** uint8_t getPinAtIndex(uint8_t index)** to get back configuration
88+
7789
7890#### Wont
7991
0 commit comments