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.
57 lines
1.1 KiB
57 lines
1.1 KiB
4 years ago
|
#include <SoftwareSerial.h>
|
||
4 years ago
|
#include <Wire.h>
|
||
4 years ago
|
#include "SIM800L.h"
|
||
4 years ago
|
#include <BME280I2C.h>
|
||
4 years ago
|
|
||
|
#define SIM800_RX_PIN 10
|
||
|
#define SIM800_TX_PIN 11
|
||
|
#define SIM800_RST_PIN 7
|
||
|
|
||
|
SIM800L* sim800l;
|
||
4 years ago
|
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 windSpeed = 0;
|
||
2 years ago
|
int windDirection = 0;
|
||
4 years ago
|
|
||
4 years ago
|
float temperature = 0;
|
||
|
float humidity = 0;
|
||
|
float pressure = 0;
|
||
|
|
||
|
bool printSensorsData = true;
|
||
4 years ago
|
|
||
|
void setup() {
|
||
|
// Initialize Serial Monitor for debugging
|
||
4 years ago
|
Serial.begin(9600);
|
||
4 years ago
|
while(!Serial);
|
||
|
|
||
4 years ago
|
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);
|
||
|
|
||
4 years ago
|
// Setup modules
|
||
|
setupSIM800L();
|
||
|
setupBME280();
|
||
|
timer = millis() + timerLimit;
|
||
4 years ago
|
}
|
||
|
|
||
|
void loop() {
|
||
4 years ago
|
|
||
|
getWind();
|
||
4 years ago
|
|
||
|
}
|