Skip to content

Instantly share code, notes, and snippets.

View Miceuz's full-sized avatar

Albertas Mickėnas Miceuz

View GitHub Profile
@Miceuz
Miceuz / Chirp Arduino example
Created February 9, 2015 20:01
Chirp Arduino example
/*
Chirp - arduino example
Connection
Chirp pin 1 - no connection
Chirp pin 2 - Arduino VCC
Chirp pin 3 - Arduino A5
Chirp pin 4 - Arduino A4
Chirp pin 5 - Arduino pin 2
Chirp pin 6 - Arduino GND
@Miceuz
Miceuz / rs485-sensor-tester.ino
Created November 22, 2018 13:56
Script for Arduino to test rs485 sensors
#include <Bounce2.h>
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
#include <SdFat.h>
SoftwareSerial softSerial(2, 3); // RX, TX
Bounce button = Bounce();
ModbusMaster sensor;
SdFat sd;
This file has been truncated, but you can view the full file.
execve("/usr/bin/chronograf", ["chronograf", "-v", "-l", "debug"], 0xbed1c60c /* 30 vars */) = 0
getpid() = 2604
sched_getaffinity(0, 8192, [0]) = 4
mmap2(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f3b000
mmap2(NULL, 270663680, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6d1b000
brk(NULL) = 0x4d48000
mmap2(0x5000000, 541065216, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5000000
clock_gettime(CLOCK_MONOTONIC, {tv_sec=65989, tv_nsec=730575215}) = 0
mmap2(0x5000000, 4194304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x5000000
mmap2(0xa6d1b000, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa6d1b000
//the original code by Ted Meyers
//posted here: https://groups.google.com/d/msg/diyrovers/lc7NUZYuJOg/ICPrYNJGBgAJ
#include <Wire.h>
#define VL53L0X_REG_IDENTIFICATION_MODEL_ID 0xc0
#define VL53L0X_REG_IDENTIFICATION_REVISION_ID 0xc2
#define VL53L0X_REG_PRE_RANGE_CONFIG_VCSEL_PERIOD 0x50
#define VL53L0X_REG_FINAL_RANGE_CONFIG_VCSEL_PERIOD 0x70
#define VL53L0X_REG_SYSRANGE_START 0x00
#include <PID_v1.h>
#include <Hash.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ArduinoOTA.h>
#include <Bounce2.h>
#!/usr/bin/python
#by Daniel Tamm
from chirp import Chirp
import sys
if len(sys.argv) < 3:
print "Usage: %s old_addr new_addr" % (sys.argv[0])
print "Standard Chirp address is 0x20 (32)."
print "Use ''i2cdetect -y 1'' to see your current Chirp addresses."
@Miceuz
Miceuz / avrdude.conf
Last active January 4, 2018 16:00
avrdude.conf patch for AtTiny441
#------------------------------------------------------------
# ATTiny441
#------------------------------------------------------------
part
id = "t441";
desc = "ATtiny441";
has_debugwire = yes;
flash_instr = 0xB4, 0x07, 0x17;
/*
* A controller for Schiederwerk PVG 12-12 AC Electronic Lamp Power Supply
* for metal halide lamps
*
* © Albertas Mickėnas 2016
* albertas@technarium.lt mic@wemakethings.net
* This code is Open Source distributed under Apache 2.0 licence.
*/
#include <Bounce2.h>
#include <Bounce2.h>
Bounce but1 = Bounce();
Bounce but2 = Bounce();
byte outPin[8] = {2,3,5,6, 8,9,11,12}; // kintamuju masyvas nepaeiliui pasiskirsciusiems pin'ams suzymeti
byte outNo = 0; // ciklams prasukti
int input; // nuskaityto analoginio iejimo reiksmei irasineti
// int lygis = 0; // lygis arba kitaip tariant
int koefi = 10; // analoginio signalo iejimo sriprinimo koeficientas (kartais). Leisgtinos ribos 10...50 (bet jei nepakaks, galima meginti ir iki 200).
#include "Tlc5940.h"
void setup() {
Tlc.init();
}
void fadeOut() {
for(int j = 4095; j >= 0; j--){
for(int i = 0; i < 16; i++) {
Tlc.set(i, j);