-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathWeatherSensorWH2.h
More file actions
37 lines (33 loc) · 823 Bytes
/
WeatherSensorWH2.h
File metadata and controls
37 lines (33 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
WeatherSensorWH2.h - Library for receiving wireless data from the WH2
wireless temperature and humidity sensor.
Created by Luc Small on 30 April 2012.
Released into the public domain.
*/
#ifndef WeatherSensorWH2_h
#define WeatherSensorWH2_h
/* Added to provide compatibility with Arduino 1.0 and 0022 */
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class WeatherSensorWH2
{
public:
WeatherSensorWH2();
void accept(byte interval);
bool acquired();
int get_sensor_id();
byte* get_packet();
byte calculate_crc();
bool valid();
int get_temperature();
String get_temperature_formatted();
byte get_humidity();
private:
byte _packet[5];
bool _acquired;
uint8_t _crc8( uint8_t *addr, uint8_t len);
};
#endif