-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
78 changed files
with
10,421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Example testing sketch for various DHT humidity/temperature sensors | ||
// Written by ladyada, public domain | ||
|
||
#include "DHT.h" | ||
|
||
#define DHTPIN 4 // what pin we're connected to | ||
|
||
// Uncomment whatever type you're using! | ||
//#define DHTTYPE DHT11 // DHT 11 | ||
#define DHTTYPE DHT22 // DHT 22 (AM2302) | ||
//#define DHTTYPE DHT21 // DHT 21 (AM2301) | ||
|
||
// Connect pin 1 (on the left) of the sensor to +5V | ||
// Connect pin 2 of the sensor to whatever your DHTPIN is | ||
// Connect pin 4 (on the right) of the sensor to GROUND | ||
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor | ||
|
||
DHT dht(DHTPIN, DHTTYPE); | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
Serial.println("DHTxx test!"); | ||
|
||
dht.begin(); | ||
} | ||
|
||
void loop() { | ||
// Reading temperature or humidity takes about 250 milliseconds! | ||
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) | ||
float h = dht.readHumidity(); | ||
float t = dht.readTemperature(); | ||
|
||
// check if returns are valid, if they are NaN (not a number) then something went wrong! | ||
if (isnan(t) || isnan(h)) { | ||
Serial.println("Failed to read from DHT"); | ||
} else { | ||
Serial.print("Humidity: "); | ||
Serial.print(h); | ||
Serial.print(" %\t"); | ||
Serial.print("Temperature: "); | ||
Serial.print(t); | ||
Serial.println(" *C"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv | ||
* An IR detector/demodulator must be connected to the input RECV_PIN. | ||
* Version 0.1 July, 2009 | ||
* Copyright 2009 Ken Shirriff | ||
* http://arcfn.com | ||
*/ | ||
|
||
#include <IRremote.h> | ||
|
||
int RECV_PIN = A0; | ||
|
||
IRrecv irrecv(RECV_PIN); | ||
|
||
decode_results results; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
irrecv.enableIRIn(); // Start the receiver | ||
} | ||
|
||
void loop() { | ||
if (irrecv.decode(&results)) { | ||
Serial.println(results.value, HEX); | ||
irrecv.resume(); // Receive the next value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* IRremote: IRrecvDump - dump details of IR codes with IRrecv | ||
* An IR detector/demodulator must be connected to the input RECV_PIN. | ||
* Version 0.1 July, 2009 | ||
* Copyright 2009 Ken Shirriff | ||
* http://arcfn.com | ||
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post) | ||
*/ | ||
|
||
#include <IRremote.h> | ||
|
||
int RECV_PIN = 9; | ||
|
||
IRrecv irrecv(RECV_PIN); | ||
|
||
decode_results results; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
irrecv.enableIRIn(); // Start the receiver | ||
} | ||
|
||
// Dumps out the decode_results structure. | ||
// Call this after IRrecv::decode() | ||
// void * to work around compiler issue | ||
//void dump(void *v) { | ||
// decode_results *results = (decode_results *)v | ||
void dump(decode_results *results) { | ||
int count = results->rawlen; | ||
if (results->decode_type == UNKNOWN) { | ||
Serial.print("Unknown encoding: "); | ||
} | ||
else if (results->decode_type == NEC) { | ||
Serial.print("Decoded NEC: "); | ||
} | ||
else if (results->decode_type == SONY) { | ||
Serial.print("Decoded SONY: "); | ||
} | ||
else if (results->decode_type == RC5) { | ||
Serial.print("Decoded RC5: "); | ||
} | ||
else if (results->decode_type == RC6) { | ||
Serial.print("Decoded RC6: "); | ||
} | ||
else if (results->decode_type == PANASONIC) { | ||
Serial.print("Decoded PANASONIC - Address: "); | ||
Serial.print(results->panasonicAddress,HEX); | ||
Serial.print(" Value: "); | ||
} | ||
else if (results->decode_type == JVC) { | ||
Serial.print("Decoded JVC: "); | ||
} | ||
Serial.print(results->value, HEX); | ||
Serial.print(" ("); | ||
Serial.print(results->bits, DEC); | ||
Serial.println(" bits)"); | ||
Serial.print("Raw ("); | ||
Serial.print(count, DEC); | ||
Serial.print("): "); | ||
|
||
for (int i = 0; i < count; i++) { | ||
if ((i % 2) == 1) { | ||
Serial.print(results->rawbuf[i]*USECPERTICK, DEC); | ||
} | ||
else { | ||
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC); | ||
} | ||
Serial.print(" "); | ||
} | ||
Serial.println(""); | ||
} | ||
|
||
|
||
void loop() { | ||
if (irrecv.decode(&results)) { | ||
Serial.println(results.value, HEX); | ||
dump(&results); | ||
irrecv.resume(); // Receive the next value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend | ||
* An IR LED must be connected to Arduino PWM pin 3. | ||
* Version 0.1 July, 2009 | ||
* Copyright 2009 Ken Shirriff | ||
* http://arcfn.com | ||
*/ | ||
|
||
#include <IRremote.h> | ||
|
||
IRsend irsend; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
} | ||
|
||
void loop() { | ||
delay(250); | ||
if (Serial.read() != -1) { | ||
for (int i = 0; i < 3; i++) { | ||
irsend.sendSony(0xa90, 12); // Sony TV power code | ||
delay(40); | ||
} | ||
} | ||
} |
Submodule MJW_RFM2Pi
added at
1b4450
Submodule RFM2Pi
added at
e7669f
Oops, something went wrong.