McGarrah Technical Blog

Raspberry Pi 2 built-in LED

For an assignment in my robotics class, I need to have an autonomous system react to the environment around it. Reacting can be as simple as flashing a LED if a sensor detects a change.

I have two objectives for the Raspberry Pi 2 (RasPi2) and those are to take a picture using the 5mp webcam and flash a LED. I could use the standard GPIO pins and setup a separate LED but noticed we have two perfectly good LEDs built into the board.

Reading on these built-in LED did not elicit any clear way of interacting with them from the regular Linux documentation. I informally called them the Red Power and Green DiskIO LEDs. It was by reading the headers to the source for Windows 10 for Raspberry Pi 2 that I found the GPIO pinouts for these two LEDs. They are:

35 Red Power LED
47 Yellow DiskIO LED

Python TimeDate functions

I needed a quick understanding of the Python 3.3.0 datetime functionality to do a difference in times across days. Python make it amazingly easy.

import datetime
from datetime import timedelta

# get current timedate
now = datetime.datetime.now()
print "now: " + str(now)
# get one day of time oneday = timedelta(days=1)
# make one day in the future and past
tomorrow = now + oneday
yesterday = now - oneday
print "tomorrow: " + str(tomorrow)
print "yesterday: " + str(yesterday)
# compare times
if now < tomorrow:
  print "now < tomorrow"
elif now > tomorrow:
  print "now > tomorrow"
else:
  print "now must be equal tomorrow"
if now > yesterday:
 print "now > yesterday"
elif now < yesterday:
 print "now < yesterday"
else:
 print "now = yesterday"

The expected results are:

CMD> python time.py
now: 2015-03-19 14:30:31.083000
tomorrow: 2015-03-20 14:30:31.083000
yesterday: 2015-03-18 14:30:31.083000
now < tomorrow
now > yesterday

I hope this helps someone.

Rackspace Cloud Load Balancer with Windows 2012 IIS

I’m working on a problem with Windows 2012 RTM server running an IIS web service. To load balance it, we decided to use Rackspace Cloud Load Balancers. Periodically we receive some errors that appear in the system event logs.

"A fatal alert was generated and sent to the remote endpoint. This may result in termination of the connection. The TLS protocol defined fatal error code is 40. The Windows SChannel error state is 1205."

Wildcard SSL Certificates

I’m beginning to setup enough infrastructure that a wildcard certificate would be nice but I’m uninterested in paying several hundred dollars a year for that certificate. The free certs that used to be around just are not there anymore so far as I can see. My goal is to setup SSL certificates for both my email server and all the virtual host web sites I’m hosting under my mcgarrah.org domain for less than a hundred dollars a year.

Posts