Learning Python with the Raspberry Pi Starter Kit.
Getting to grips with Linux and Python with the Pi starter kit
First off, Introductions. My name is Natasha and I’m as scared of coding in Python as I would be of an actual Python. I am in the process of completing my HND in Electronic and Electrical Engineering, I’m new to the world of electronics and like most Electronic Engineers I’m no programmer, and I’m not as fluent in any programming languages as I would like to be. I picked an Electrical engineering course as originally wanted to go into Medical engineering, not knowing that I would find the utilisation of electrical energy or PLCs as fascinating as I do. As I learned, I started to become aware of the technology around me that I take for granted every day. Suddenly I noticed the automatic doors, the cables connecting devices, the overhead power lines I drove past — everything. With that new found awareness of just how much goes into making the supermarket door open for me, my curiosity grew. Now here I am, blogging for you. Julie Andrews said “let’s all start at the very beginning, a very good place to start” and who am I to argue, so let’s start with the unboxing.
Everything you need to get started
The Raspberry Pi starter kit is, just like the box says “Everything you need to get started with Raspberry Pi”. Though the Pi itself can be picked up for around £30 on line, the starter kit comes with the protective case, a keyboard, mouse, HDMI cable, power cable, a pre-programmed micro SD packed with the software and a book to help you get started. All you need to do is find yourself a monitor and your set. If like I mentioned earlier, you opt for just the Pi, the SD card is usually included, if not, you can always get your own and download the new out of box software, cleverly named NOOBS, directly from raspberrypi.org website onto a laptop and drag and drop it onto an SD card that you can then use in your Pi.
The Raspberry Pi itself is spectacular, it can do pretty much anything a laptop can, you can play games, go on the internet, play movies, and all on something the size of a credit card. The New Pi 3 has roughly twice the RAM and 10 times the CPU performance of the original. It comes with a micro-USB socket to power the Pi, a HDMI video port to connect to a screen, camera connector, an audio socket for headphones or speakers, an Ethernet connector and four USB ports, allowing for use of both the USB powered keyboard, mouse and a WI-FI adapter if the Ethernet is too old school for you. It easy enough to physically set up. Just plug in and play. Software wise, booting up is a doddle too.
The first time you boot up, you’re presented with a list of operating systems. Raspbian is the recommended, but whichever you choose you just check the box and sit back while the pi does all the installing. If like me you opt for the recommended, you get a warning message that everything on the SD card will be erased and the install will begin. It lets you know when it’s finished, reboots and automatically configures, you might as well grab a cuppa, there’s not much to do yet. You do need to press enter twice, once when you select “enable boot to desktop/scratch” and then again after selecting “Desktop Log in as user Pi at the Graphical Desktop” but I’m sure you can manage that.
The first look at Linux
Now that were up and running, we get our first look at Linux. Linux is an open source operating system that uses the UNIX notions that came about in the early days of computing as an alternate choice to the duopoly of Mac and Windows. Once your desktop has loaded head to the top of the screen where you’ll find your menu, and from there you can access the internet, play games, find your programming options. Then just to the right of that you’ll find your Terminal button. If you’re a Mac or Windows user like me, you’re probably not familiar with it, but you’ll find that this is the place you go to find things, rather than relying on clicking icons to open files. For the minute, however, what we’re interested in is the dreaded Python.
The very basics of Python coding
The time has come to create some programs, and Python is the language to do that. To get started we need to go to our task bar, hit the Raspberry Pi icon and drop down into the programming option, then select Python 3 IDLE. This opens what we call a Shell. This is where the magic happens, it’s where you type your commands and see what they do. While the shell is the place to get creative, and you can write your programs in there, after a bit of playing around, I found it easier to write in the Text Editor. My first command was
print(‘hello’). The Print part tells the Raspberry Pi that you want it to return you a value, the part inside the quotation marks is the value you want it to return. In this case it returns the word hello on the next line. We can do a little more here, and I think it’s easier to see the command of returning values in the following lines of code. First of all I gave the program a range of 1-10 by entering
for x in range(1,10): then I asked it to return me all the values possible in that range by entering
print (x). The program then returned me all the values between 1 and 10, listing them below for me. It really was that simple.
I was tasked with setting up Raspberry Pi and getting it to return the words hello world to me, and I must say, that python wasn’t half as scary as I thought it would be. I will have to get to get to grips with the world of case-sensitive typing, colons, brackets, and indentation in order to complete my next task — Interfacing hardware, turning on and controlling an LED using a switch — but if this is anything to go by, I look forward to it, and as cheesy as it sounds, people do mean it when they say “If I can do it then so can you” or at least I do anyway.
CommentsAdd a comment
"in the early days of computing as an alternate choice to the duopoly of Mac and Windows." I got a good chuckle over that. Your youth is showing ;-) Not only were computers used in business decades before that, even I owned two "personal" computes for over a decade before either Windows or Mac arrived on the scene. Now my age is showing :-))
@Graig Pearen Yes the Trash 80 and my commodore 64.... I remember how excited I was to get my first IBM 8088 I purchased my first hard drive for that and it cost more than the car I was driving at the time. It was a HUGE 10 megabytes . Now my age is showing.