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: