This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "loraiot_server", | |
"version": "1.0.0", | |
"description": "LoRa IoT Server", | |
"main": "index.js", | |
"engines": { | |
"node": "10.15.0", | |
"npm": "6.5.0" | |
}, | |
"scripts": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const morgan = require("morgan"); | |
const compression = require("compression"); | |
const bodyParser = require("body-parser"); | |
const cookieSession = require("cookie-session"); | |
// const passport = require("passport"); | |
const keys = require("./config/keys"); | |
//Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "CatLoRaS76S.h" | |
#define _DEBUG 1 | |
#define _PIN_RX 11 | |
#define _PIN_TX 10 | |
#define _LED_BUIDIN 13 | |
#define _MAC_SIP_RESET "sip reset" | |
#define _MAC_SET_CH_FREQ "mac set_ch_freq" | |
#define _MAC_SET_RX2 "mac set_rx2" | |
#define _MAC_SAVE "mac save" | |
#define _MAC_SET_CLASS "mac set_class" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TimeLib.h> | |
#include <Wire.h> | |
#include <DS3231.h> | |
DS3231 clock; | |
char datetimeBuffer[32]; | |
uint8_t seconds = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DateTimeLib.h" | |
const uint8_t daysArray[] PROGMEM = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
uint32_t DateTimeLib::unixtime(const char *datetime) | |
{ | |
return DateTimeLib::unixtime(String(datetime)); | |
} | |
uint32_t DateTimeLib::unixtime(String datetime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "RelayModule.h" | |
RelayModule::~RelayModule() | |
{ | |
debug("is destroyed."); | |
} | |
RelayModule::RelayModule(uint8_t pin) | |
{ | |
this->pin = pin; | |
} | |
RelayModule::RelayModule(uint8_t pin, uint8_t mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void loraReceive() { | |
String receive = lora.receive(); | |
if (receive != "") { | |
unsigned int rxPort = lora.getPortReceive(receive); | |
String rxPayload = lora.getPayloadReceive(receive); | |
if (rxPort != 0 && rxPayload != "") { | |
Serial.println("-----RX From CAT LORA-----"); | |
Serial.println(String("Port = ") + rxPort); | |
Serial.println(String("Payload = ") + rxPayload); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Screen.h" | |
Screen::~Screen() | |
{ | |
delete this->screen; | |
} | |
void Screen::begin() | |
{ | |
Adafruit_SSD1306 *dis = new Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
#include <Wire.h> | |
#include <Adafruit_BMP085.h> | |
#include <HTS221.h> | |
#include <DHT.h> | |
#define SCREEN_WIDTH 128 // OLED display width, in pixels | |
#define SCREEN_HEIGHT 64 // OLED display height, in pixels | |
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Downlink from Lora IoT by CAT is 012020012412105920200124143000 (00yyyyMMddhhmmssyyyyMMddhhmmss) | |
Device : RelayA => 01, RelayB => 02 | |
Start : 2020-01-24 12:10:59 => 20200124121059 | |
Stop : 2020-01-24 14:30:00 => 20200124143000 | |
*/ | |
#include <TimeLib.h> | |
#include <Wire.h> | |
#include <DS3231.h> | |
#include <DHT.h> |
OlderNewer