Sunday, May 5, 2013

4: Since my last post:

I tried adding software by the--

  sudo apt-get ...

method. And I learned (again) that doing things as super-user (i.e., "sudo") is inherently dangerous. The last such download (wish I remembered what it was, exactly) corrupted my flash filesystem. I only found out when I rebooted. Anyway, it was back to downloading a new copy of the OS. This time I am doing a better job of backing up the Pi to a folder on my Mac.

When I initialized the system, this time I set up the US keyboard the easy way and added SSH at the same time. Now my Pi sessions go as follows:

1. Power up the Pi.
2. Start SSH from my iMac Terminal app:
      ssh pi@192.168....
3. Mount the Pi "Home Folder" on the iMac.
4. Play with the Pi
5. Copy any new Python code to a backup folder on the iMac. 
6. Shutting down:
      sudo shutdown 1
7. Pull the power plug.

Here's a little Python program that prints the CPU temperature:

#cputemp.py
import commands
import re

str = commands.getoutput('/opt/vc/bin/vcgencmd measure_temp')

r = re.match(r'.*=(\d+\.\d)', str)
c = r.group(1)
c = float(c)
f = int(( c * 1.8) + 32.0)

print "Pi CPU temp=", f, "F, ", c, "C"
if c >= 80.0:
    print("Don't fry your Pi -- 80C is the max. safe CPU temp!")


My Pi runs at a little over 40C in its plastic case.

No comments:

Post a Comment