Skip to content

Instantly share code, notes, and snippets.

@choonewza
choonewza / package.json
Created January 10, 2019 08:29
stm32lora_loraiot_ep3-package.json
{
"name": "loraiot_server",
"version": "1.0.0",
"description": "LoRa IoT Server",
"main": "index.js",
"engines": {
"node": "10.15.0",
"npm": "6.5.0"
},
"scripts": {
@choonewza
choonewza / index.js
Created January 17, 2019 03:59
stm32lora_loraiot_ep3-server
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
@choonewza
choonewza / CatLoRaS76S.cpp
Last active January 17, 2020 08:31
Content of CAT LoRa Lab 5
#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"
@choonewza
choonewza / content-catlora-lab7.ino
Last active January 22, 2020 05:42
Content CatLoRa Lab 7
#include <TimeLib.h>
#include <Wire.h>
#include <DS3231.h>
DS3231 clock;
char datetimeBuffer[32];
uint8_t seconds = 0;
@choonewza
choonewza / DateTimeLib.cpp
Last active January 23, 2020 02:39
Content CAT LORA LAB 8
#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)
@choonewza
choonewza / RelayModule.cpp
Last active January 25, 2020 17:26
Content CAT LORA LAB 9
#include "RelayModule.h"
RelayModule::~RelayModule()
{
debug("is destroyed.");
}
RelayModule::RelayModule(uint8_t pin)
{
this->pin = pin;
}
RelayModule::RelayModule(uint8_t pin, uint8_t mode)
@choonewza
choonewza / content-catlora-lab9-loraReceive.ino
Created January 25, 2020 08:12
Content CAT LoRa Lab 9 - loraReceive Function
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);
#include "Screen.h"
Screen::~Screen()
{
delete this->screen;
}
void Screen::begin()
{
Adafruit_SSD1306 *dis = new Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
@choonewza
choonewza / sensor_comparing.ino
Last active January 26, 2020 14:50
Content CAT LoRa Lab11 - compare sensor
#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)
/*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>