Skip to content

Instantly share code, notes, and snippets.

#include "EEPROM.h"
#define EEPROM_SIZE 8
void setup() {
while (!EEPROM.begin(EEPROM_SIZE)) {
true;
}
}
include <HardwareSerial.h>
HardwareSerial MySerial(1);
void setup() {
MySerial.begin(9600, SERIAL_8N1, 16, 17);
}
void loop() {
while (MySerial.available() > 0) {
#include <SPI.h>
#include <LoRa.h>
volatile bool doRead = false; // Flag set by callback to perform read process in main loop
volatile int incomingPacketSize;
void setup() {
Serial.begin(9600);
while (!Serial);
@DzikuVx
DzikuVx / DisplayCM.ino
Created August 21, 2017 19:24 — forked from reefwing/DisplayCM.ino
Sharp GP2Y0A02YK0F IR Distance Sensor (20-150 cm) Arduino Library
#include <GP2Y0A02YK0F.h>
GP2Y0A02YK0F irSensor;
int distance;
void setup()
{
Serial.begin(9600);
irSensor.begin(A0); // Assign A0 as sensor pin
}
#include <VirtualWire.h>
uint8_t currentPacket = 0;
void setup() {
/*
* Set TX pin -> Connect FS1000A here
*/
vw_set_tx_pin(12);
/*
#include <VirtualWire.h>
uint8_t counter = 0;
void setup() {
/*
* Set TX pin -> Connect FS1000A here
*/
vw_set_tx_pin(12);
/*
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESP8266mDNS.h>
#include <ESP8266WiFi.h>
#define ALLOWED_CONNECT_CYCLES 40
#define ALLOWED_READ_CYCLES 80
#define ONE_WIRE_BUS 2 // DS18B20 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
@DzikuVx
DzikuVx / serial_queue.js
Created January 21, 2017 21:17
JavaScript PID controller example usage
privateScope.loadPidController = new classes.PidController();
privateScope.loadPidController.setTarget(privateScope.targetLoad);
privateScope.loadPidController.setOutput(0, 97, 0);
privateScope.loadPidController.setGains(16, 6, 4);
privateScope.loadPidController.setItermLimit(0, 90);
@DzikuVx
DzikuVx / pid_controller.js
Created January 21, 2017 20:54
Simple JavaScript PID controller
'use strict';
var classes = classes || {};
classes.PidController = function () {
var self = {},
privateScope = {};
/**
/*
* PPM generator originally written by David Hasko
* on https://code.google.com/p/generate-ppm-signal/
*/
//////////////////////CONFIGURATION///////////////////////////////
#define CHANNEL_NUMBER 12 //set the number of chanels
#define CHANNEL_DEFAULT_VALUE 1500 //set the default servo value
#define FRAME_LENGTH 22500 //set the PPM frame length in microseconds (1ms = 1000µs)
#define PULSE_LENGTH 300 //set the pulse length