antitheft159 commited on
Commit
3f92108
·
verified ·
1 Parent(s): d31f709

Upload dictatiAestimo.159.ino

Browse files
Files changed (1) hide show
  1. dictatiAestimo.159.ino +32 -0
dictatiAestimo.159.ino ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #inclue "MLPLibrary.h"
2
+
3
+ const int pirPin = 2;
4
+ const int inputSize = 1;
5
+ const int hiddenSize = 4;
6
+ const int outputSize = 1;
7
+ const float learnRate = 0.1;
8
+
9
+ MLPLibrary mlp(inputSize, hiddenSize, outputSize, learningRate);
10
+ float inputData[inputSize];
11
+ float outputData[outputSize];
12
+ void setup() {
13
+ // put your setup code here, to run once:
14
+ pinMode(pirPin, INPUT);
15
+ mlp.initialize();
16
+ Serial.begin(9600);
17
+ }
18
+
19
+ void loop() {
20
+ // put your main code here, to run repeatedly:
21
+ int pirValue = digitalRead(pirPin);
22
+
23
+ inputData[0] = pirValue;
24
+
25
+ mlp.predict(inputData, outputData);
26
+
27
+ if (outputData[0] > 0.5) {
28
+ Serial.println("INtrusion Detected!");
29
+ }
30
+
31
+ delay(1000);
32
+ }