Skip to content

Instantly share code, notes, and snippets.

View YongHuax's full-sized avatar

hooi yong hua YongHuax

View GitHub Profile
@YongHuax
YongHuax / Security_Box.ino
Last active March 22, 2017 03:03
( SP ) Jkr SensorBox Stream Light(LDR) , Humidy(DHT) & Temperature(DS182B20+DHT) to ThingSpeak thru NodeMCU Esp8266 ---------- ( More Info in Comments )
#include <ESP8266WiFi.h>
#include <DHT.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define dht_dpin 13 // D7, Digital Pin sensor is connected to
#define myPeriodic 15 //in sec | Thingspeak pub is 15sec
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
@YongHuax
YongHuax / LoRa_Client_Ard_Con.ino
Created January 3, 2018 14:01
LoRa_Client Arduino
/*
LoRa Simple Client for Arduino :
Support Devices: LoRa Shield + Arduino
Example sketch showing how to create a simple messageing client,
with the RH_RF95 class. RH_RF95 class does not provide for addressing or
reliability, so you should only use RH_RF95 if you do not need the higher
level messaging abilities.
It is designed to work with the other example LoRa Simple Server
@YongHuax
YongHuax / LoRa_Simple_Arduino_Server_Mod.ino
Created January 3, 2018 14:05
LoRa Simple Arduino Server
/*
LoRa Simple Arduino Server :
Support Devices:
* LoRa Mini
* LoRa Shield + Arduino;
* LoRa GPS Shield + Arduino.
Example sketch showing how to create a simple messageing server,
with the RH_RF95 class. RH_RF95 class does not provide for addressing or
reliability, so you should only use RH_RF95 if you do not need the higher
@YongHuax
YongHuax / LoRa_UM402_Sender.ino
Last active January 4, 2018 03:06
LoRa_UM402_Sender
#include <SoftwareSerial.h>
SoftwareSerial lora(2, 3); //TX, RX
// gnd SET_A and SET_B for Normal Mode (Send and Receive)
void setup() {
Serial.begin(9600);
lora.begin(9600);
}
@YongHuax
YongHuax / ESP32_LoRa_Wifi_Oled_Send
Created January 17, 2018 23:08
ESP32_LoRa_Wifi Send with OLED functionality
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
@YongHuax
YongHuax / ESP32_LoRa_Wifi_Oled_Send
Created January 17, 2018 23:08
ESP32_LoRa_Wifi Send with OLED functionality
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
@YongHuax
YongHuax / Final_OLED_LoRa_Sender.ino
Created February 8, 2018 23:05
FYP_Final_LoRa_Sender
/*
This is a simple example show the LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
@YongHuax
YongHuax / testAWS
Last active February 15, 2018 06:01
LG01-P Linux Script to AWSIot
#!/bin/sh
#when connecting to AWSIOT , a cert , privatekey and certificate authority file is required .
#after downloading the cert files when creating a thing , it is possible rename the files so that it is easier to
#call the file when writing the script and cli
#also note that aws things shadow update requires message to be in json to update
#to catch messages sent to things but are rejected due to improper json format , subscribe to things shadow update through mqtt.
# do remember to check the activity page for the AWsiot " thing" u have created to see whether the message is accepted or rejected
HOST="a1k3lzqvylq236.iot.ap-southeast-1.amazonaws.com"
@YongHuax
YongHuax / Lora_Receiver_LG01_P_Mqtt.ino
Last active February 10, 2018 20:15
Final_Fyp_LoRa_Receiver_LG01_P_Mqtt
#include <SPI.h>
#include <LoRa.h>
#include <Console.h>
#include <Process.h>
#define PABOOST true
#define BAND 433E6
void uploadData();
@YongHuax
YongHuax / testmqtt
Last active February 10, 2018 19:41
Test for LG01-P to Mqtt
#!/bin/sh
#The following code demonstrates a basic command using mosquitto client to connect to public broker hivemq using port 1883
# publish to topic yhtest with message "ok"
#it is possible to copy and paste the following line of code to Dragino Linux cli to run command .
mosquitto_pub -h broker.hivemq.com -p 1883 -t yhtest -m "ok"