Skip to content

Instantly share code, notes, and snippets.

View thearduinoguy's full-sized avatar

Mike McRoberts thearduinoguy

View GitHub Profile
// Sensor Node Transmitter - Mike McRoberts
#define RF69_COMPAT 1
#include <JeeLib.h> //from jeelabs.org
#define nodeID 10 //node ID of tx (range 0-30)
#define nodeGroup 50 //network group (can be in the range 1-250).
#define nodeFreq RF12_433MHZ //Freq of RF12B can be RF12_433MHZ, RF12_868MHZ or RF12_915MHZ. Match freq to module
typedef struct { byte battery, year, month, day, hour, minute, second, sensorByte1, sensorByte2; } PacketTX; // create structure - a neat way of packaging data for RF comms
@thearduinoguy
thearduinoguy / PowerTest.cpp
Created November 3, 2014 21:01
Sensor Power Test
#include <RFM69.h>
#include <SPI.h>
#include <JeeLib.h>
#include <Wire.h>
#include "HTU21D.h"
ISR(WDT_vect) { Sleepy::watchdogEvent(); }
HTU21D myHumidity;
@thearduinoguy
thearduinoguy / SensorNodeTransmitvB5.ino
Created November 11, 2014 20:33
Sensor Node Transmit vB5
//===============================================
// Wireless sensor node transmission code
// ATMega328 with RFM69CW + Sensor
// M.McRoberts 2014
//===============================================
#include <RFM69.h>
#include <SPI.h>
#include <JeeLib.h>
#include <Wire.h>
@thearduinoguy
thearduinoguy / numbersFromString.lua
Created February 27, 2015 21:24
How to find the numbers in a string (Lua)
local counter = 0
digits = {}
for w in string.gmatch(s, "%d+") do
digits[counter] = w
print(digits[counter])
counter = counter+1
end
#include <Button.h>
#include <SoftwareSerial.h>
#include <EEPROM.h>
#define LEFT_PIN 5
#define RIGHT_PIN 4
#define ENTER_PIN 6
#define PULLUP false
#define INVERT false
#define DEBOUNCE_MS 20
#include <EEPROM.h>
void setup()
{
Serial.begin(115200);
int eepromfirst = EEPROM.read(100);
Serial.println("address 100 = " + String(eepromfirst));
int eepromRead1 = EEPROM.read(135);
@thearduinoguy
thearduinoguy / FilledBoxGen.ino
Created April 7, 2019 16:15
Filled Box Generator
int height = 3;
int width = 7;
void setup()
{
Serial.begin (115200);
}
void loop()
Challenge 1.
Generate box with hollow centre, such as:
4x4 box (This can be any height x width)
####
# #
# #
####
bool isBST()
{
bool isBST = false;
int BSTStart = ((31 - ((((5 * year()) / 4) + 4 ) % 7)));
int BSTEnd = (31 - ((((5 * year()) / 4) + 1) % 7));
if (month() >= 4 && month() <= 9)
{
isBST = true;
}
else if (month() == 3 && day() >= BSTStart && hour() >= 1)
//#include <ESP8266WiFi.h>
#include <WiFi.h>
#include <WiFiUdp.h>
#include <FastLED.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define DATA_PIN 25 // Data Pin
#define NUM_LEDS 625 // Number of LEDs