Skip to content

Instantly share code, notes, and snippets.

View zerog2k's full-sized avatar

Jens J. zerog2k

  • DFW, TX, USA
View GitHub Profile
;Allocation info for local variables in function '_delay_ms_old'
;------------------------------------------------------------
;ms Allocated to registers r7
;i Allocated to registers r6
;j Allocated to registers r5
;------------------------------------------------------------
; src/blinky.c:26: void _delay_ms_old(unsigned char ms)
; -----------------------------------------
; function _delay_ms_old
; -----------------------------------------
// adapted from http://www.dfrobot.com/wiki/index.php?title=GPS_Module_With_Enclosure_%28SKU:TEL0094%29
//
#include <TinyGPS.h>
#include <LiquidCrystal.h>
TinyGPS gps;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //LCD driver pins
int led = 13;
@zerog2k
zerog2k / stc15f_prog.c
Last active January 13, 2024 23:16
stc mcu programmer sample code from stc website for stc15f series, with some google translate ;)
/*---------------------------------------------------------------------*/
/* --- STC MCU Limited ------------------------------------------------*/
/* --- To be downloaded from the ISP chip (limited STC15 series), for example using the main chip -----------------*/
/* --- Mobile: (86)13922805190 ----------------------------------------*/
/* --- Fax: 86-755-82905966 -------------------------------------------*/
/* --- Tel: 86-755-82948412 -------------------------------------------*/
/* --- Web: www.STCMCU.com --------------------------------------------*/
/* If you want to use this code in the program, in the program, using the information and procedures specified macro crystal technology */
/* If you want to quote this code in the article, please indicate in the article the use of information technology and procedures Wang Jing */
/*---------------------------------------------------------------------*/
@zerog2k
zerog2k / main.c
Last active November 18, 2015 14:43
STC15F204EA sdcc blinky example
#include <stc12.h>
#include <stdint.h>
#include <stdio.h>
/* ------------------------------------------------------------------------- */
/* Printing functions */
/* ------------------------------------------------------------------------- */
#include "./soft_serial/serial.h"
#define printf printf_small
> dofile("mqtt_client_switch.lua");
...SNIP SNIP...
dhcp client start...
connecting to wifi...
connecting to wifi...
connecting to wifi...
connecting to wifi...
connecting to wifi...
connecting to wifi...
connecting to wifi...
-- based upon work by rutierut and MikeV
-- control gpio pin from mq
wifiname = "MYWIFINET"
wifipass = "MYWIFIPASS"
broker = "BROKERIP" -- IP or hostname of MQTT broker
mqttport = 1883 -- MQTT port (default 1883)
mqtttopic = "switch1"
userID = "" -- username for authentication if required
@zerog2k
zerog2k / user_main.c
Last active June 27, 2023 17:50
acurite 5n1 weather station decode over 433 mhz ask rx module on esp8266
/*
// acurite 5n1 weather station (VN1TXC)
// decoding over 433MHz ASK superhet RX module
// on ESP8266 SDK
//
// Jens Jensen, 2015
//
// todo: emit wx packets as json
// todo: add webserver code
*/
@zerog2k
zerog2k / tmp513reader.ino
Last active December 16, 2020 08:05
read TI TMP513/TMP512 (all-in-one current, voltage, temp sensors) via I2C on arduino
// read TI TMP512/TMP513 over I2C
// Jens Jensen AF5MI 2014
#include <Wire.h>
// address of device - see datasheet, assumes A0 = SCL.
#define ADDR 0x5F
// current calibration register, see datasheet for calc
// I = (V_shunt * CalReg) / 4096
@zerog2k
zerog2k / tmp513test.py
Last active August 29, 2015 14:07
read TI TMP513 (all-in-one current, voltage, temp sensors) via I2C on raspberry pi, python implementation
#!/usr/bin/python
# read TI TMP512/TMP513 over I2C
# Jens Jensen AF5MI 2014
import wiringpi2 as wp
import time
# i2c address of device - see datasheet, assumes A0 = SCL.
ADDR = 0x5F
@zerog2k
zerog2k / tmp513test.c
Last active August 29, 2015 14:07
read TI TMP513 (all-in-one current, voltage, temp sensors) via I2C on raspberry pi
// read TI TMP512/TMP513 over I2C
// Jens Jensen AF5MI 2014
#include <wiringPi.h>
#include <wiringPiI2C.h>
#include <stdio.h>
// address of device - see datasheet, assumes A0 = SCL.
#define ADDR 0x5F