Skip to content

Instantly share code, notes, and snippets.

@bigjosh
bigjosh / NoPartsBatteryGauge.c
Last active April 7, 2022 09:51
Sample code for a no parts, no pins, no power supply voltage detection on ATTINY84
/*
* NoPartsBatteryGuageAVR.c
*
* This is a simplified demonstration of how to detect power supply voltage by using the on chip
* analog-to-digital converter to measure the voltage of the internal band-gap reference voltage.
*
* The code will read the current power supply voltage, and then blink an LED attached to pin 6 (PA7).
*
* 1 blink = 1 volts <= Vcc < 2 volts (only applicable on low voltage parts like ATTINY84AV)
* 2 blinks = 2 volts <= Vcc < 3 volts
@bigjosh
bigjosh / gist:358964bad63c53684612
Last active August 29, 2015 14:08
TyTower LED Blink Code
// RGB_Tiny Board Testing for Common Anode Rgb Leds
// with LOW it lgiths up the led and with HIGH it lights off because its INVERTED due to common anode rgb led
/*.
ATTiny85 Pinout
(PCINT5/!RESET//ADC0/dW)PB5 -1 8- VCC
(PCINT3/XTAL1/CLK1/!OC1B/ADC3)PB3 -2 7- PB2(SCK/USCK/SCL/ADC1/T0/INT0/PCINT2)
(PCINT4/XTAL2/CLK0/OC1B/ADC2)PB4 -3 6- PB1(MISO/D0/AIN1/OC0B/OC1A/PCINT1)
GND -4 5- PB0(MOSI/D1/SDA/AIN0/OC0A/!OC1A/AREF/PCINT0)
*/
@bigjosh
bigjosh / gist:41dec494662dd7b3e3bf
Created February 23, 2015 18:07
Check analog input value
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}}
void loop() {
@bigjosh
bigjosh / iBitTest.s
Created January 8, 2016 21:00
Test different wasy of setting the I bit in SREG on AVR
; Test if instruction after I bit in SREG is set is always run
; More info at http://wp.josh.com/2016/01/05/different-ways-to-set-i-bit-in-avr-sreg-besides-sei/
jmp start // Reset vector
.org INT0addr
INT0_handler:
loop1:
@bigjosh
bigjosh / log.prop
Created January 25, 2016 17:10
A sample log properties file for running the Engine821 server with logging handled by JDK1.4 logging package and writing to local files
andlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.pattern=e821server.log
# Write 10MB before rotating this file
java.util.logging.FileHandler.limit=10000000
@bigjosh
bigjosh / OPMLog.log
Created February 24, 2016 22:34
Log file showing Outlook 2016 new version POP3 bug. See http://wp.josh.com/2016/02/24/outlook-2016s-buggy-pop3/ for details.
2016.02.24 13:01:18 <<<< Logging Started (level is LTF_TRACE) >>>>
2016.02.24 13:01:18 Resource manager terminated
2016.02.24 13:40:00 <<<< Logging Started (level is LTF_TRACE) >>>>
2016.02.24 13:40:00 test@test.com: Synch operation started (flags = 00000001)
2016.02.24 13:40:00 test@test.com: UploadItems: 0 messages to send
2016.02.24 13:40:00 test@test.com: Synch operation completed
@bigjosh
bigjosh / TimerShotTimer1A.ino
Last active April 13, 2018 22:13
Code to generate a one-shot pulse on AVR Timer1A by Nevell Greenough, N2GX. More info about this program is here... http://wp.josh.com/2015/03/05/the-perfect-pulse-some-tricks-for-generating-precise-one-shots-on-avr8/
// **************** TimerShot for Timer 1A *********************
// More info about this program is here...
// http://wp.josh.com/2015/03/05/the-perfect-pulse-some-tricks-for-generating-precise-one-shots-on-avr8/
// Demo of a technique to generate various precise one shot pulses using
// timer 1 module on an AVR. This demo code version is writen for an Arduino Uno or Mega2560 for the
// the Timer1 moudule, but this technique should would on other 16-bit AVR timers on Mega2560.
// Original code by Josh Levine, hack by N2GX 8/30/2016.
// Long-pulse working solution for TIMER 1A One-Shot, edited from Josh's Timer2 code and a partial Timer3 solution
@bigjosh
bigjosh / TimerShotTimer1B.ino
Created September 1, 2016 02:42
Code to generate a one-shot pulse on AVR Timer1B by Nevell Greenough, N2GX. More info about this program is here... http://wp.josh.com/2015/03/05/the-perfect-pulse-some-tricks-for-generating-precise-one-shots-on-avr8/
// **************** TimerShot for Timer 1B *********************
// More info about this program is here...
// http://wp.josh.com/2015/03/05/the-perfect-pulse-some-tricks-for-generating-precise-one-shots-on-avr8/
// Demo of a technique to generate various precise one shot pulses using
// timer 1 module on an AVR. This demo code version is writen for an Arduino Uno or Mega2560 for the
// the Timer1 moudule, but this technique should would on other 16-bit AVR timers on Mega2560.
// Original code by Josh Levine, hack by N2GX 8/30/2016.
// Long-pulse working solution for TIMER 1B One-Shot, edited from Josh's Timer2 code and a partial Timer3 solution
root@beaglebone:~# iw list
Wiphy phy0
max # scan SSIDs: 4
max scan IEs length: 2257 bytes
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Device supports RSN-IBSS.
Supported Ciphers:
* WEP40 (00-0f-ac:1)
@bigjosh
bigjosh / main.c
Last active May 13, 2018 21:19
PWM Motor control code for AIRBOAT running on ATTINY10
/*
* Attiny10 AIRBOAT PWM Motor control code
*
* Created: 12/2/2016 6:17:47 PM
* Author : josh
*/
#include <avr/io.h>
#include <util/delay.h>