You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.4 KiB
70 lines
1.4 KiB
#include <SoftwareSerial.h>
|
|
#include <Wire.h>
|
|
#include "SIM800L.h"
|
|
#include <BME280I2C.h>
|
|
|
|
#define SIM800_RX_PIN 10
|
|
#define SIM800_TX_PIN 11
|
|
#define SIM800_RST_PIN 7
|
|
|
|
SIM800L* sim800l;
|
|
BME280I2C bme;
|
|
|
|
|
|
const char APN[] = "TM";
|
|
String BASE_URL = "http://2.238.194.8/index.php?";
|
|
//String BASE_URL = "https://postman-echo.com/get?";
|
|
|
|
String s = "";
|
|
char URL[100];
|
|
|
|
|
|
int anemometerPin = 6;
|
|
int anemometerVal = 0;
|
|
int anemometerState = 0;
|
|
unsigned long anemometerDuration = 0;
|
|
unsigned long startime = 0;
|
|
unsigned long timer = 0;
|
|
int windSpeed = 0;
|
|
|
|
float temperature = 0;
|
|
float humidity = 0;
|
|
float pressure = 0;
|
|
|
|
int northPin = 4;
|
|
int eastPin = 5;
|
|
int southPin = 2;
|
|
int westPin = 3;
|
|
|
|
int timerLimit = 10000;//300000; // 5 minutes
|
|
String windDirection = "";
|
|
bool printSensorsData = true;
|
|
|
|
|
|
void setup() {
|
|
// Initialize Serial Monitor for debugging
|
|
Serial.begin(9600);
|
|
while(!Serial);
|
|
|
|
pinMode(13, OUTPUT);
|
|
digitalWrite(13, HIGH);
|
|
|
|
// Initialize a SoftwareSerial
|
|
SoftwareSerial* serial = new SoftwareSerial(SIM800_RX_PIN, SIM800_TX_PIN);
|
|
serial->begin(9600);
|
|
delay(1000);
|
|
|
|
// Initialize SIM800L driver with an internal buffer of 200 bytes and a reception buffer of 512 bytes, debug disabled
|
|
sim800l = new SIM800L((Stream *)serial, SIM800_RST_PIN, 200, 512);
|
|
|
|
// Setup modules
|
|
setupSIM800L();
|
|
setupBME280();
|
|
timer = millis() + timerLimit;
|
|
}
|
|
|
|
void loop() {
|
|
|
|
getWind();
|
|
|
|
}
|