Skip to content

Instantly share code, notes, and snippets.

@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
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 / AvrSerialPin
Created January 2, 2017 21:51
Output a byte on a pin as serial data. Good for debugging, especially if your scope as serial decode.
// Print as a serial bit stream on PB2 - Each bit is 17us, just about 38400 baud - LSB first - for debugging.
void sprint( uint8_t x ) {
DDRB |= _BV(2);
PORTB |= _BV(2); // Idle on serial port
_delay_us(22);
PORTB &= ~_BV(PORTB2); // start bit
@bigjosh
bigjosh / TileHAL.h
Created January 12, 2017 22:19
Proposed hardware abstraction layer for the tile.
/*
* AutomaTileHAL.h
*
* Created: 1/6/2016 11:56:26
* Proposed hardware abstraction layer for the tile.
*
* This layer only handles the bare minimum for interfacing with the hardware, all normal
* gam-designer-facing functionality is in a portable library that interacts with this HAL.
*
*
/*
* ATTINY85-LED-Boost.c
* Full article at
* http://wp.josh.com/2017/03/20/blinking-blue-powering-a-3-7-volt-blue-led-from-a-2-4-volt-coin-cell-with-a-0-02-charge-pump
*
*/
#include <avr/io.h>
#define F_CPU 1000000 // 1MHz, default for 8MHz internal osc and clkdiv8
@bigjosh
bigjosh / breath.c
Last active June 20, 2017 19:31
Breathing LED for Arduino or AVR C. Adafuit profile. Data in flash.
#include <avr/pgmspace.h>
const PROGMEM uint8_t breath_data[] = {
64, 68, 72, 76, 81, 85, 90, 95, 100, 105, 110, 116, 121, 127, 132, 138,
144, 150, 156, 163, 169, 176, 182, 189, 196, 203, 211, 218, 225, 233, 241, 249,
255, 249, 241, 233, 225, 218, 211, 203, 196, 189, 182, 176, 169, 163, 156, 150,
144, 138, 132, 127, 121, 116, 110, 105, 100, 95, 90, 85, 81, 76, 72, 68
};
#define BREATH_LEN (sizeof( breath_data) / sizeof( *breath_data ))