Skip to content

Commit 1f4379e

Browse files
authored
Merge pull request #1 from pilotak/dev
new version
2 parents da958ef + 3af0661 commit 1f4379e

File tree

13 files changed

+602
-283
lines changed

13 files changed

+602
-283
lines changed

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
5+
sudo: false
6+
cache:
7+
directories:
8+
- "~/.platformio"
9+
10+
install:
11+
- pip install -U platformio
12+
- platformio update
13+
- platformio lib -g install 5763
14+
- platformio lib -g install https://github.com/pilotak/MCP3X21
15+
16+
script:
17+
- platformio ci --lib="." --board=uno "./examples/timers/WeatherMeters_AVR"
18+
- platformio ci --lib="." --board=esp32dev "./examples/timers/WeatherMeters_ESP32"
19+
- platformio ci --lib="." --board=d1_mini "./examples/timers/WeatherMeters_ESP8266"
20+
- platformio ci --lib="." --board=bluepill_f103c8 "./examples/timers/WeatherMeters_STM32"
21+
- platformio ci --lib="." --board=d1_mini "./examples/WeatherMeters_adhoc"
22+
- platformio ci --lib="." --board=d1_mini "./examples/WeatherMeters_external_ADC"
23+
24+
notifications:
25+
email:
26+
on_success: change
27+
on_failure: change

README.md

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
# Weather Meters
2-
Arduino library for processing wind speed, wind wane and rain gauge sensors (WH 1080, Sparkfun)
2+
[![Build Status](https://travis-ci.org/pilotak/WeatherMeters.svg?branch=master)](https://travis-ci.org/pilotak/WeatherMeters) [![Framework Badge Arduino](https://img.shields.io/badge/framework-arduino-00979C.svg)](https://arduino.cc)
33

4-
It's interupt based library with callbacks and ready to use on any board. The only difference accros boards would be in initializing 1 second timer, ie. on STM32 you could use RTC timer, ESP32 has its own timer object, Timer1 could be used Arduino Uno (ATmega328P) etc.
4+
Arduino library for processing wind speed, wind wane and rain gauge sensors (WH1080, WH1090, Sparkfun)
55

6-
# Example on STM32 platform
6+
It's interupt based library with callbacks and ready to use on any board. The only difference accros boards would be in initializing 1 second timer, ie. on STM32 you could use RTC timer, ESP32 has its own timer object, Timer1 could be used Arduino Uno (ATmega328P) etc please see `examples/timers`
7+
8+
# Example
79

810
```cpp
9-
#include <RTClock.h>
1011
#include "WeatherMeters.h"
1112

12-
#define anemometer_pin PB12
13-
#define windvane_pin PB1
14-
#define raingauge_pin PB14
15-
16-
#define SAMPLES 8 // = 8 sec output
13+
const int windvane_pin = A0;
14+
const int anemometer_pin = 2;
15+
const int raingauge_pin = 3;
1716

18-
volatile bool got_data = false;
19-
20-
RTClock rtclock(RTCSEL_LSE);
21-
WeatherMeters meters(windvane_pin, SAMPLES);
17+
WeatherMeters <6> meters(windvane_pin); // filter last 6 directions
2218

2319
void intAnemometer() {
2420
meters.intAnemometer();
@@ -28,35 +24,22 @@ void intRaingauge() {
2824
meters.intRaingauge();
2925
}
3026

31-
void secondCount() {
32-
meters.secondCount();
33-
}
34-
35-
void readDone(void) {
36-
got_data = true;
37-
}
38-
3927
void setup() {
4028
Serial.begin(115200);
4129

4230
attachInterrupt(digitalPinToInterrupt(anemometer_pin), intAnemometer, FALLING);
4331
attachInterrupt(digitalPinToInterrupt(raingauge_pin), intRaingauge, FALLING);
44-
meters.attach(readDone);
45-
rtclock.attachSecondsInterrupt(secondCount);
46-
47-
meters.init();
4832
}
4933

5034
void loop() {
51-
if (got_data) {
52-
got_data = false;
53-
Serial.print("Wind degrees: ");
54-
Serial.print(meters.getWindVane(), 1);
55-
Serial.print(" Wind speed: ");
56-
Serial.print(meters.getWindSpeed(), 1);
57-
Serial.print("km/h, Rain: ");
58-
Serial.print(meters.getRainGauge(), 4);
59-
Serial.println("mm");
60-
}
35+
Serial.print(F("Wind degrees: "));
36+
Serial.print(meters.getDir(), 1);
37+
Serial.print(F(" Wind speed: "));
38+
Serial.print(meters.getSpeed(), 1);
39+
Serial.print(F("km/h, Rain: "));
40+
Serial.print(meters.getRain(), 4);
41+
Serial.println(F("mm"));
42+
43+
delay(8000);
6144
}
6245
```

WeatherMeters.cpp

Lines changed: 0 additions & 194 deletions
This file was deleted.

0 commit comments

Comments
 (0)