programming avrs

February 8th, 2010

I have been working on avr project for almost a year now.  As I have been getitng closer to completion I have finally jumped from arduino to my own custom avr board.   Then came the problem of programming the icsp.  I tried 2 different serial and parallel programmers to no luck.  And then I thought why not use an arduino to programmer to program my avr 168p.  I tried 4 different software ones to no luck and then found this mega-isp  . works great,  I was able to flash my avr with no troubles I highly recommend it.

working with avr and pwm

February 6th, 2010

I seemed to have a lot of trouble getting pwm code going.  below is some simple code that got me going.  looking back on it now I am unsure as to why I was having such problems.  I think its because, arduino, port codes, and timer codes, and pwm codes dont exactly match and I wasnt looking at the reference material.  anyways hope this helps.

int main (void)
{
DDRD |= (1<< PD3) | (1<< PD5) | (1<< PD6);
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|(1<<WGM01)|(1<<WGM00);
TCCR0B = (1<<CS00);
TCCR2A = (1<<COM2A1)|(1<<COM2B1)|(1<<WGM21)|(1<<WGM20);
TCCR2B = (1<<CS20);
OCR0A = 0;
OCR0B = 100;
OCR2B = 255;
sei();
while (1)
{
;
}
}

Latitude where am I 2 electric boogaloo!

February 3rd, 2010

I decided having it post to my blog wasnt just enough.  Why not track myself via google constantly.  below is the bash script i have running in cron minutely to record my coordinates.  Enjoy.

#!/bin/bash

#License GPLv3
ID=""
Points=/home/mog/docs/whereiam/points
cd $Points
if [ `ls .|wc -l` -eq 0 ]; then
wget -q "http://www.google.com/latitude/apps/badge/api?user=${ID}&type=json" -O new
mv new `date +%s`
else
File=`ls |tail -n1`
Last_Time_Stamp=`grep timeStamp $File|cut -f2 -d':'|cut -f1 -d','`
wget -q "http://www.google.com/latitude/apps/badge/api?user=${ID}&type=json" -O new
if grep -q $Last_Time_Stamp new ; then
rm new
else
mv new `date +%s`
fi
fi

Latitude where am i?

February 3rd, 2010

Recently I have been playing around with google latitude.  The footer below is a wordpress plugin I made that echos out my current location to the city level at the base of the blog.   enjoy

/*
Plugin Name: Hello Latitude
Plugin URI: http://wordpress.org/#
Description: working on it
Author: Matthew O'Gorman
Version: 0.1
Author URI: http://rldn.net/

License :AGPLv3
*/

function hello_latitude() {
$googleLatID=”"; //find this at http://www.google.com/latitude/apps/badge
$url =”http://www.google.com/latitude/apps/badge/api?user=”.$googleLatID.”&type=json”;
try{
$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$results = json_decode($contents, true);
$loc=”I am in “.$results['features'][0]['properties']['reverseGeocode'];
echo $loc;
}
catch (Exception $e){
echo ‘LOCATION NOT FOUND!’;
}
}
add_action(’wp_footer’, ‘hello_latitude’);
?>

Hello world!

January 12th, 2010

no more drupal and I built first plugin as seen below says where I am to city level from google latitude api


I am in Huntsville, AL, USA