Contact Us

Use the form on the right to contact us.

You can edit the text in this area, and change where the contact form on the right submits to, by entering edit mode using the modes on the bottom right. 


Oak Ridge, TN, 37830
United States

Lyf-Hacking

Shortcuts, easter eggs, and the exaustingly fun pursuit of solving lifes problems in unconventional ways.

Tank Project - Part 5.... getting my py on.

Wade Cantley

The burning of the OS image worked great.  At first I loaded the Kano version but that was way too much for kids and less for programming.  That and I think it is geared for the Pi2-B which is a step above my little Pi.

With Raspbian burned to disk, I gave it a whirl and BAM!  Works like a charm.

But going into the application I realize now that Python3 or Python2 is a very stripped down command prompt interface and while I am sure there is a better programming interface for the Raspberry Pi, I think I am going to first learn up on the code on my PC.

Now to get on with my python learning.

To start with, I don't know first thing about python but it is a programming language which means there is some sort of interpretive engine or a compiler, and an IDE of some sort.

Sure enough!

Interpreter : https://www.python.org/downloads/
IDE : https://www.jetbrains.com/pycharm/?fromMenu

In installed Python 3 only to realize that most of the tutorials out there are for Python 2 which has some differences in coding syntax so, I installed Python 2 and off we go.

So baby steps, the next thing I need to is figure out how to call on an API.

CodeAcademy seems to be helpful with this.  
http://www.codecademy.com/courses/python-intermediate-en-6zbLp/0/1?curriculum_id=50ecbb00306689057a000188

SUCCESS!!!!!

Granted, that is in New York but getting my latitude and longitude is just a quick trip to Google maps.

Here is the code for fetching this XML.

from urllib2 import Request, urlopen, URLError

request = Request('http://www.earthtools.org/sun/40.71417/-74.00639/4/12/-5/0')

try:
    response = urlopen(request)
    timestuff = response.read()
    print timestuff[1:100000]
except URLError, e:
    print 'UUUHHHGGGGG. Got an error code:', e

Next up, I will  need to figure out how to parse out the dates so that I can figure out how to time the intervals.  I may also need to figure out how to create an executable so that it runs continuously.   But one step at a time.