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.

71 lines
1.4 KiB

4 years ago
#include <SoftwareSerial.h>
#include <Wire.h>
4 years ago
#include "SIM800L.h"
#include <BME280I2C.h>
4 years ago
#define SIM800_RX_PIN 10
#define SIM800_TX_PIN 11
#define SIM800_RST_PIN 7
SIM800L* sim800l;
BME280I2C bme;
4 years ago
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;
4 years ago
int northPin = 4;
int eastPin = 5;
int southPin = 2;
int westPin = 3;
int timerLimit = 10000;//300000; // 5 minutes
4 years ago
String windDirection = "";
bool printSensorsData = true;
4 years ago
void setup() {
// Initialize Serial Monitor for debugging
Serial.begin(9600);
4 years ago
while(!Serial);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
4 years ago
// 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;
4 years ago
}
void loop() {
getWind();
4 years ago
}