質問編集履歴

2

ソースコード

2016/11/23 10:31

投稿

kkkooo
kkkooo

スコア7

test CHANGED
File without changes
test CHANGED
@@ -20,15 +20,11 @@
20
20
 
21
21
  ###該当のソースコード
22
22
 
23
- ```ここに言語を入力
23
+ #include<SPI.h>
24
24
 
25
- ここにご自身が実行したソースコードを書いてください
26
-
27
- ```#include<SPI.h>
25
+ #include <Ethernet2.h>
28
26
 
29
27
  #include <EthernetUdp2.h>
30
-
31
- #include <Ethernet2.h>
32
28
 
33
29
  #include <Twitter.h>
34
30
 
@@ -56,7 +52,7 @@
56
52
 
57
53
  delay(1000);
58
54
 
59
- Ethernet2.begin(mac, ip);
55
+ Ethernet.begin(mac, ip);
60
56
 
61
57
  Serial.begin(9600);
62
58
 
@@ -71,8 +67,6 @@
71
67
 
72
68
 
73
69
  void loop() {
74
-
75
- EthernetClient client = server.available();
76
70
 
77
71
  if (alarm == HIGH)
78
72
 

1

ソースコードを入れました

2016/11/23 10:31

投稿

kkkooo
kkkooo

スコア7

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,79 @@
24
24
 
25
25
  ここにご自身が実行したソースコードを書いてください
26
26
 
27
+ ```#include<SPI.h>
28
+
29
+ #include <EthernetUdp2.h>
30
+
31
+ #include <Ethernet2.h>
32
+
33
+ #include <Twitter.h>
34
+
35
+
36
+
37
+
38
+
39
+ byte mac[] = { };
40
+
41
+ byte ip[] = {};
42
+
43
+ Twitter twitter("");
44
+
45
+ int alarm = 7;
46
+
47
+ int lever = 6;
48
+
49
+ int greenLED = 4;
50
+
51
+
52
+
53
+ void setup()
54
+
55
+ {
56
+
57
+ delay(1000);
58
+
59
+ Ethernet2.begin(mac, ip);
60
+
61
+ Serial.begin(9600);
62
+
63
+ pinMode(alarm, INPUT);
64
+
65
+ pinMode(lever, INPUT);
66
+
67
+ pinMode(greenLED, OUTPUT);
68
+
69
+ }
70
+
71
+
72
+
73
+ void loop() {
74
+
75
+ EthernetClient client = server.available();
76
+
77
+ if (alarm == HIGH)
78
+
79
+ {
80
+
27
- ```http://www.instructables.com/id/tweeting-Arduino-alarm-with-one-PIR-sensor-aka-Ala/こちらのサイトのものを使いました
81
+ twitter.post("alarm activated");
82
+
83
+ }
84
+
85
+
86
+
87
+ else
88
+
89
+ {
90
+
91
+ digitalWrite(greenLED, HIGH);
92
+
93
+ }
94
+
95
+
96
+
97
+
98
+
99
+ }
28
100
 
29
101
 
30
102