projects
/
Arduino
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
27f9c89
)
read DS18B20 temperature
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 30 Nov 2014 16:15:18 +0000
(17:15 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 30 Nov 2014 16:15:18 +0000
(17:15 +0100)
rpi_promini/rpi_promini.ino
patch
|
blob
|
history
diff --git
a/rpi_promini/rpi_promini.ino
b/rpi_promini/rpi_promini.ino
index
cf22f81
..
fe7cc6a
100644
(file)
--- a/
rpi_promini/rpi_promini.ino
+++ b/
rpi_promini/rpi_promini.ino
@@
-6,20
+6,33
@@
RXD TXD
TXD RXD
GPIO6 RST
RXD TXD
TXD RXD
GPIO6 RST
+ GND GND
+ +5V RAW
+
+ 2 433Mhz receive
+ 10 433Mhz send
+ 11 DS18B20
*/
#include <RCSwitch.h>
*/
#include <RCSwitch.h>
+#include <OneWire.h>
+#include <DallasTemperature.h>
RCSwitch mySwitch = RCSwitch();
RCSwitch mySwitch = RCSwitch();
+// DS18B20 on pin 11
+OneWire oneWire(11);
+DallasTemperature sensors(&oneWire);
+
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
mySwitch.enableTransmit(10); // with sender wired in receiving doesn't work, pin #10
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
mySwitch.enableTransmit(10); // with sender wired in receiving doesn't work, pin #10
-
+ // DS18B20
+ sensors.begin();
Serial.print("press buttons on remote or send AB where A = socket (0..9), B = state (0 = off, 1 = on)\nB00...00 (24 digits) to send binary\n");
}
Serial.print("press buttons on remote or send AB where A = socket (0..9), B = state (0 = off, 1 = on)\nB00...00 (24 digits) to send binary\n");
}
@@
-37,6
+50,11
@@
void loop() {
}
if (Serial.available() > 0) {
char input = Serial.read();
}
if (Serial.available() > 0) {
char input = Serial.read();
+ if ( input == 'T' ) {
+ Serial.print("DS18B20 temperature = ");
+ sensors.requestTemperatures();
+ Serial.println( sensors.getTempCByIndex(0) );
+ } else
if ( input == 'B' ) {
Serial.readBytesUntil('\n', binary_data, sizeof(binary_data));
Serial.print("send B");
if ( input == 'B' ) {
Serial.readBytesUntil('\n', binary_data, sizeof(binary_data));
Serial.print("send B");