Raspberry Pi Python Programing: Day 3

6 Jan

Today, I went and got a Python book from the library.  My uncle also emailed me some basic information about raspbpi and python.  My dad and I started reading the book.  The first program was to guess a random number between 1 and 100.  We tried to do this the first time we were learning python and couldn’t figure it out.  Now that I’ve seen the program in this book, I understand it.

Then, we wanted to write a similar program so we wrote one that would flip a coin and let you guess heads or tails.  Then we changed it to flip the coin three times and tell you how many guesses you got right.  Then we changed it to ask how many times you want to flip the coin and it flips that many times and then tells you how many you got right.  I would share the program with you, but I don’t know how.  I asked my uncle and if I can, I’ll share it later.  Maybe later, we can add pictures of a coin and make it look better than just text.

So far, in python, I’ve learned how to print, how to take input, what a string is, how to make random numbers, and how to do simple calculations.  I can use print and input together to ask a question and get an answer from whoever is using the program.  I also learned the difference between “=” and “==” and how to use “while”.

I forgot the other day, I also learned how to shut the raspberry pi off correctly.  My uncle said that I can hurt it if I just unplug it.  To turn it off, I type “sudo halt”.  (I’ve learned that “sudo shutdown now” might be even better since it should turn the power off too.) 

That reminds me of something else I forgot to tell you.   I put all of my games on a flash drive for the Atari emulator.  I found out that you cannot unplug the flash drive while the raspbpi is running or it shuts off.  That is probably not good for it.  I got in the mail today a breadboard, a ribbon cable, some LEDs, some wires and some buttons to work on projects soon.   I’ll let you know how it goes.

To connect the Raspberry Pi to LEDs or other things, you need to use the GPIO pins.  Here’s a video about how to use them:


3 Responses to “Raspberry Pi Python Programing: Day 3”

  1. Robert Nix January 9, 2013 at 1:09 pm #

    If you’d like to see some simple breadboard projects for your Pi, have a look at my site: http://www.rpural.net. There are several examples laid out there.

    • krystal92586 January 9, 2013 at 4:48 pm #

      That would be GREAT I love looking for new blogs with new ideas. 😀

    • krystal92586 January 11, 2013 at 7:53 pm #

      Great stuff, thanks for the LED tutorial. Too bad the spammers shut down your comments. I’ve gotten a few on here as you can see too.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: