Skip to content

Instantly share code, notes, and snippets.

View sabas1080's full-sized avatar
🐈
Working

Sabas sabas1080

🐈
Working
View GitHub Profile
int valor = 0;
void setup() {
// put your setup code here, to run once:
pinMode(13,OUTPUT);
pinMode(10,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(10)==1)
___________ ________ .__
\__ ___/___ \_____ \ __ __|__| ___________ ____
| |_/ __ \ / / \ \| | \ |/ __ \_ __ \/ _ \
| |\ ___/ / \_/. \ | / \ ___/| | \( <_> )
|____| \___ > \_____\ \_/____/|__|\___ >__| \____/
\/ \__> \/
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 0, /* radio_1 provides clock to concentrator */
"radio_0": {
"enable": true,
"type": "SX1257",
"freq": 912200000,
"rssi_offset": -166.0,
"tx_enable": true
@sabas1080
sabas1080 / lora.c
Last active November 2, 2017 01:58
// http://ww1.microchip.com/downloads/en/DeviceDoc/40001864B.pdf
int8_t nwkSKey[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB,
0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
uint8_t appSKey[16] = {0x3C, 0x8F, 0x26, 0x27, 0x39, 0xBF, 0xE3, 0xB7, 0xBC,
0x08, 0x26, 0x99, 0x1A, 0xD0, 0x50, 0x4D};
uint32_t devAddr = 0x1100000F;
uint8_t endDeviceJoinedFlag = false;
void RxData(uint8_t* pData, uint8_t dataLength, OpStatus_t status)
@sabas1080
sabas1080 / global.json
Last active November 7, 2017 01:25
Global JSON polypacket
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 0, /* radio_1 provides clock to concentrator */
"radio_0": {
"enable": true,
"type": "SX1257",
"freq": 912200000,
"rssi_offset": -166.0,
"tx_enable": true
@sabas1080
sabas1080 / IFTTT_arduino.ino
Created September 11, 2017 00:09
Example IFTTT and Arduino for SGuru 2017
/************************************************************
ESP8266_NodeMCU_IFTTT_Maker.ino
IFTTT Channel Maker Posting Example
Andres Sabas @ The Inventor's House
Original Creation Date: Jan 10, 2016
This example demonstrates how to use the TCP client
functionality of the ESP8266 WiFiSecure library to post
to a IFTTT event on
https://ifttt.com
Development environment specifics:
#include <ESP8266WiFi.h>
char ssid[] = "Twim"; // your network SSID (name)
char pass[] = "12345678"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
char server[] = "arduino.cc";
// Initialize the Ethernet client object
WiFiClient client;
// Include & enable library functions
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
// Set softserial for Uno board comment for Mega board
SoftwareSerial Serial1(3, 4); // RX, TX
@sabas1080
sabas1080 / PROGMEM.md
Created March 11, 2017 04:06 — forked from sticilface/PROGMEM.md
PROGMEM

Guide to PROGMEM on ESP8266 and Arduino IDE

Intro

On low memory devices like the arduino and esp8266 you do not want strings to be stored in RAM. This occurs by default on these systems. Declare a string const char * xyz = "this is a string" and it will use up RAM.

The solution on these devices is to allow strings to be stored in read only memory, in Arduino this is the PROGMEM macro. Most of my experience is with the ESP8266 which is a 32bit micros controller. This device stores PROGMEM data in flash. The macro PROGMEM on ESP8266 is simply

#define PROGMEM   ICACHE_RODATA_ATTR
#include <TheThingsNetwork.h>
#include <SoftwareSerial.h>
#define RESET 15
//SoftwareSerial loraSerial(4, 5); // RX, TX !! labels on relay board is swapped !!
#define loraSerial Serial1
#define debugSerial Serial
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915