Skip to content

Commit

Permalink
Merge pull request #1 from pilotak/dev
Browse files Browse the repository at this point in the history
new version
  • Loading branch information
pilotak authored Oct 14, 2018
2 parents da958ef + 3af0661 commit 1f4379e
Show file tree
Hide file tree
Showing 13 changed files with 602 additions and 283 deletions.
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: python
python:
- "2.7"

sudo: false
cache:
directories:
- "~/.platformio"

install:
- pip install -U platformio
- platformio update
- platformio lib -g install 5763
- platformio lib -g install https://github.com/pilotak/MCP3X21

script:
- platformio ci --lib="." --board=uno "./examples/timers/WeatherMeters_AVR"
- platformio ci --lib="." --board=esp32dev "./examples/timers/WeatherMeters_ESP32"
- platformio ci --lib="." --board=d1_mini "./examples/timers/WeatherMeters_ESP8266"
- platformio ci --lib="." --board=bluepill_f103c8 "./examples/timers/WeatherMeters_STM32"
- platformio ci --lib="." --board=d1_mini "./examples/WeatherMeters_adhoc"
- platformio ci --lib="." --board=d1_mini "./examples/WeatherMeters_external_ADC"

notifications:
email:
on_success: change
on_failure: change
53 changes: 18 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# Weather Meters
Arduino library for processing wind speed, wind wane and rain gauge sensors (WH 1080, Sparkfun)
[![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)

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.
Arduino library for processing wind speed, wind wane and rain gauge sensors (WH1080, WH1090, Sparkfun)

# Example on STM32 platform
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`

# Example

```cpp
#include <RTClock.h>
#include "WeatherMeters.h"

#define anemometer_pin PB12
#define windvane_pin PB1
#define raingauge_pin PB14

#define SAMPLES 8 // = 8 sec output
const int windvane_pin = A0;
const int anemometer_pin = 2;
const int raingauge_pin = 3;

volatile bool got_data = false;

RTClock rtclock(RTCSEL_LSE);
WeatherMeters meters(windvane_pin, SAMPLES);
WeatherMeters <6> meters(windvane_pin); // filter last 6 directions

void intAnemometer() {
meters.intAnemometer();
Expand All @@ -28,35 +24,22 @@ void intRaingauge() {
meters.intRaingauge();
}

void secondCount() {
meters.secondCount();
}

void readDone(void) {
got_data = true;
}

void setup() {
Serial.begin(115200);

attachInterrupt(digitalPinToInterrupt(anemometer_pin), intAnemometer, FALLING);
attachInterrupt(digitalPinToInterrupt(raingauge_pin), intRaingauge, FALLING);
meters.attach(readDone);
rtclock.attachSecondsInterrupt(secondCount);

meters.init();
}

void loop() {
if (got_data) {
got_data = false;
Serial.print("Wind degrees: ");
Serial.print(meters.getWindVane(), 1);
Serial.print(" Wind speed: ");
Serial.print(meters.getWindSpeed(), 1);
Serial.print("km/h, Rain: ");
Serial.print(meters.getRainGauge(), 4);
Serial.println("mm");
}
Serial.print(F("Wind degrees: "));
Serial.print(meters.getDir(), 1);
Serial.print(F(" Wind speed: "));
Serial.print(meters.getSpeed(), 1);
Serial.print(F("km/h, Rain: "));
Serial.print(meters.getRain(), 4);
Serial.println(F("mm"));

delay(8000);
}
```
194 changes: 0 additions & 194 deletions WeatherMeters.cpp

This file was deleted.

Loading

0 comments on commit 1f4379e

Please sign in to comment.