projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ce99248
)
Улучшена обработка ошибок при работе с проводными датчиками.
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 26 Sep 2014 21:08:25 +0000
(
01:08
+0400)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 26 Sep 2014 21:08:25 +0000
(
01:08
+0400)
Weather_WH2.ino
patch
|
blob
|
history
diff --git
a/Weather_WH2.ino
b/Weather_WH2.ino
index a1796cc257985eb476b1a6c90749cb34267b2b08..175721e012753060a10e1db7227d2d6eabbbcce0 100644
(file)
--- a/
Weather_WH2.ino
+++ b/
Weather_WH2.ino
@@
-137,7
+137,18
@@
ISR(TIMER1_COMPA_vect)
}
void setup() {
}
void setup() {
-
+
+ Serial1.begin(115200); // Set the baud.
+
+ // Wait for U-boot to finish startup. Consume all bytes until we are done.
+ do {
+ while (Serial1.available() > 0) {
+ Serial1.read();
+ }
+
+ delay(1000);
+ } while (Serial1.available()>0);
+
Serial1.begin(57600);
Serial1.println();
Serial1.println("STATUS:STARTING");
Serial1.begin(57600);
Serial1.println();
Serial1.println("STATUS:STARTING");
@@
-166,6
+177,8
@@
unsigned long outdoor_interval = 45000;
unsigned long previousIndoor = 0;
unsigned long previousOutdoor = 0;
unsigned long previousIndoor = 0;
unsigned long previousOutdoor = 0;
+float temperature;
+float pressure;
void loop() {
unsigned long now;
void loop() {
unsigned long now;
@@
-211,7
+224,7
@@
void loop() {
if ((unsigned long)(now - previousMillis) >= indoor_interval) {
previousMillis = now;
if ((unsigned long)(now - previousMillis) >= indoor_interval) {
previousMillis = now;
-
+
int chk = DHT.read11(DHT11PIN);
if (chk==0) {
int chk = DHT.read11(DHT11PIN);
if (chk==0) {
@@
-223,16
+236,10
@@
void loop() {
Serial1.print(",TEMPERATURE=");
Serial1.print(DHT.temperature);
Serial1.print(",TEMPERATURE=");
Serial1.print(DHT.temperature);
- Serial1.println();
- Serial1.print("SENSOR:TYPE=BARO,");
- Serial1.print("PRESSURE=");
- Serial1.print(bmp.readPressure());
- Serial1.print(",TEMPERATURE=");
- Serial1.println(bmp.readTemperature());
-
previousIndoor = now;
digitalWrite(GREENPIN,HIGH);
previousIndoor = now;
digitalWrite(GREENPIN,HIGH);
+
} else {
Serial1.println();
} else {
Serial1.println();
@@
-242,6
+249,15
@@
void loop() {
}
}
+ pressure=bmp.readPressure();
+ temperature=bmp.readTemperature();
+ Serial1.println();
+ Serial1.print("SENSOR:TYPE=BARO,");
+ Serial1.print("PRESSURE=");
+ Serial1.print(pressure);
+ Serial1.print(",TEMPERATURE=");
+ Serial1.println(temperature);
+
}
if ((unsigned long)(now - previousIndoor) > indoor_interval*10) {
}
if ((unsigned long)(now - previousIndoor) > indoor_interval*10) {
@@
-262,6
+278,7
@@
void loop() {
}
}
+
}
}