Tuesday, May 14, 2013

Day 2 of playing with the raspberry pi.

Sent Email to myself using SMTP
Today I spent over an hour trying to send an email using python.  After a lot of experimentation, I finally got it to work.  It sent an email to one of my mailboxes on my web hosting provider's SMTP server.  That mailbox was configured to forward the email to my gmail address and my cell phone.  Getting this to work should not have been this hard.

Hello World
Next, I decided to try wiring up the electronic equivalent of the "hello world" program -- making an LED blink.  I broke out all of my electronics supplies and realized a couple of things.  First, the jumper cable kit I bought with the pi only had male to male wires.  I had expected to get some male to female jumpers.  Bummer.  Second, the ribbon cable I got is female to female.  I need one male end to connect to the breadboard.  Double bummer.

After a few minutes, I realized that I could plug the male jumper cable in to the ribbon cable and then connect to the breadboard.  Another hurdle overcome.  I plugged in the wires to the power and ground pins on the pi and from there to the breadboard.  Next, I plugged in the resister and LED.  The first resister I used was 300k ohm.  It must have been too large because the LED would not light at all.  I replaced it with a 22 ohm resister and the LED lit up.

The last step was to get the LED to flash after connecting it to a programmable GPIO pin.  I moved the pin connected to the power plug to a programmable pin.  Next, I wrote a small python program to make the LED repeatedly turn on and then off for 1 second.  That worked great as well.

So, now, I can send email to the outside world from my pi and send signals to equipment connected to the pi.

Minor Stuff
I was having weird keyboard issues like pressing the shift 2 key typed a ".  I went into configuration (sudo raspi-config) and changed my keyboard layout to a US layout.  It looked like it had been on a UK layout.

I also updated the raspi config program and then ran
sudo apt-get update and sudo apt-get upgrade
to bring the OS up to date.  The upgrade ran for a long time.  I wonder if I could put both of those commands in some kind of automated job so they run daily.

I guess that is it today.  Tomorrow, I will show Tim how to make the light blink.  There is also a programming language called Scratch that looks like a fun learning tool.

No comments:

Post a Comment