-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (39 loc) · 1.31 KB
/
Program.cs
File metadata and controls
51 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO.Ports;
namespace HomeTrid
{
public class Program
{
public static void Main()
{
HCSR04 mUS = new HCSR04(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1);
SensorReaderScheduler sensor = new SensorReaderScheduler(mUS);
//buzzer sensors
OutputPort rgbLedBlue = new OutputPort(Pins.GPIO_PIN_D2, false);
OutputPort rgbLedRed = new OutputPort(Pins.GPIO_PIN_D3, false);
OutputPort rgbLedGreen = new OutputPort(Pins.GPIO_PIN_D4, false);
while (true)
{
bool result = sensor.ReadAll();
if(!result)
{
rgbLedRed.Write(true);
Debug.Print("Someone went into my room");
HTTPHandler.sendRequest();
rgbLedRed.Write(false);
rgbLedGreen.Write(true);
Thread.Sleep(800);
rgbLedGreen.Write(false);
}
Thread.Sleep(10);
}
}
}
}