first commit
This commit is contained in:
commit
a5a0434432
1126 changed files with 439481 additions and 0 deletions
28
Software/CSharp/GrovePi/Sensors/PIRMotionSensor.cs
Normal file
28
Software/CSharp/GrovePi/Sensors/PIRMotionSensor.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
namespace GrovePi.Sensors
|
||||
{
|
||||
public interface IPIRMotionSensor
|
||||
{
|
||||
bool IsPeopleDetected();
|
||||
}
|
||||
|
||||
internal class PIRMotionSensor:Sensor<IPIRMotionSensor>, IPIRMotionSensor
|
||||
{
|
||||
public PIRMotionSensor(GrovePi device, Pin pin):base(device, pin, PinMode.Input)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool IsPeopleDetected()
|
||||
{
|
||||
int sensorValue = Device.DigitalRead(Pin);
|
||||
if (sensorValue == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue