This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <msp430.h> | |
#include "../misc.h" | |
int main(void) { | |
stop_watchdog(); | |
// set up bit 0 of P1 as output | |
// P1DIR = BIT0 | BIT6; | |
P1DIR = 0; | |
pinmode_out(1,0); | |
pinmode_out(1,6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); | |
void setup() { | |
lcd.begin(16,2); | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROG=blink | |
-include ../Makefile.simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use Device::SerialPort; | |
my $file = "/dev/tty.usbserial-A700fbpg"; | |
my $ob = Device::SerialPort->new ($file) || die "Can't open $file: $!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define print_autonamed_value(p,x) do { p.print(#x " = "); p.println(x); } while (0) | |
#define print_named_value(p,n,x) do { p.print(n " = "); p.println(x); } while (0) | |
#define time_operation(p,op,sets,counts) do { \ | |
long mstart = millis(); \ | |
for (long set = 0; set < sets; set++) { \ | |
for (long count = 0; count < counts; count++) { \ | |
op; \ | |
} \ | |
} \ | |
long mend = millis(); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compiler commandline as below: | |
// avr-gcc -mmcu=attiny85 -O2 -DF_CPU=16000000L -I. -Iusbdrv -std=c99 -Wall -g -c -o main.o main.c | |
ISR(ADC_vect) { | |
adclast = ADMUX & ~_BV(ADLAR); | |
adcreading[adclast] = ADCH; | |
ADMUX = adcmux[adclast]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "avr/interrupt.h" | |
uint8_t pots[4] = { 0, 0, 0, 0 }; | |
uint16_t samples[4] = { 0, 0, 0, 0 }; | |
const uint8_t nextpot[4] = { _BV(ADLAR) | 0b0001, _BV(ADLAR) | 0b0010, _BV(ADLAR) | 0b0011, _BV(ADLAR) | 0b0000 }; | |
void setup() { | |
Serial.begin(9600); | |
ADMUX = _BV(ADLAR) | _BV(MUX1) | _BV(MUX0); | |
ADCSRA = _BV(ADEN) | _BV(ADSC) | _BV(ADATE) | _BV(ADIE) | _BV(ADPS0)| _BV(ADPS1) | _BV(ADPS2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void GPS_Switch_Mode_To_NMEA(void) | |
{ | |
int checkSum; | |
const byte magicHead[] = { | |
0xA0, 0xA2, // start sequence | |
0x00, 0x18 // payload length 0x18 = 24 | |
}; | |
const byte magicPayload[] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LED 13 | |
#define NDIVIDERS sizeof(divider_outputs) | |
uint8_t divider_outputs[] = { | |
12, 11, 10, 9, | |
8, 7, 6, 5 | |
}; | |
void setup(void) { | |
for (uint8_t i = 0; i < NDIVIDERS; i++) { | |
pinMode(divider_outputs[i], OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# John Slee <[email protected]> | |
keep_until="heart of gold" | |
get_wifi_interface() { | |
networksetup -listallhardwareports | sed -n '/Wi-Fi$/,/^Device/ { s/.*\(en[0-9]\)$/\1/p; }' | |
} |
OlderNewer