Getting started with electronics with the Raspberry Pi : LED Hello World.

This one was long overdue, and I finally got around to doing it, and even though it’s just a damn LED light, making it glow was an extremely pleasant experience.

I just followed this video and also this video on YouTube. I highly recommend following that channel, because almost all of his videos have to do with the Raspberry Pi and electronics.

Following these two videos, I learnt the following.

Here’s a picture.

An LED light glowing. Note that here I used a 5v pin and not the GPIO pin. This 5v pin is connected to the main powerline of the Raspberry Pi.
An LED light glowing. Note that here I used a 5v pin and not the GPIO pin. This 5v pin is connected to the main powerline of the Raspberry Pi.

I also modified the code in the video above to make a birthday gift for a friend.  I hooked up an LED light to a GPIO pin, and wrote a while loop in python to make the light blink as long as the happy birthday song was playing. Here is the code.

import RPi.GPIO as GPIO
import time
import pygame
import sys

GPIO.setmode(GPIO.BOARD)
GPIO.setup(12,GPIO.OUT)

pygame.mixer.init()
pygame.mixer.music.load("song.mp3")
pygame.mixer.music.play()

while pygame.mixer.music.get_busy() == True:
 GPIO.output(12,GPIO.HIGH)
 time.sleep(1)
 GPIO.output(12,GPIO.LOW)
 time.sleep(1)
while pygame.mixer.music.get_busy() == False:
 GPIO.cleanup()
 sys.exit()

OSMC-Kodi on the Raspberry Pi

Once after launching a deauthentication attack on my unwary brother who was watching a movie on YouTube, I was overcome by a sudden feeling of guilt, because he came to me immediately afterwards and asked me if I could fix his laptop because his internet wasn’t working. Then I realized that I shouldn’t be such an asshole and so I decided to make it up to him in whatever way I can (without telling him I was responsible for his laptop not connecting, that is).

Now a while ago, I came across OSMC, which is a Debain-based Linux distro which brings Kodi (formerly called XBMC) to a variety of devices, one of them being the Raspberry pi. Now my brother is a nut, one who prefers watching Sunny Deol bash up people to breathing, and since I had to make it up to him somehow, and since I conveniently had a Raspberry pi lying around, and also since OSMC is just so damn beautiful, I decided to install it and show it to him and let him stream some more Sunny Deol.

It turned out that installing OSMC is a breeze. You just need to download the installer for your system, plug in a formatted and wiped SD card, and click on the install and sit back and relax and let it work it’s magic.

After your SD card has the OSMC bootable image on it, simply plug it back in to the Raspberry pi, attach a HDMI cable to it and the TV, and plug in the power cable. If everything’s right, you should get a beautiful splash screen with the OSMC logo on it, and that’s it! If you have a keyboard, then plug that in to the Raspberry pi and you’ll be able to control it with the keyboard. Otherwise, you can simply download the amazing Yatse app for Android, and you’ll be able to control it from your phone. iOS remotes are also available.

Here’s how the Yatse app looks like.

Now by default, OSMC doesn’t ship with the (highly illegal and definitely not recommended (*wink*) ) movie and TV show streaming add-ons, but with a little help, you should be on your way to piracy. I dabbled in piracy of the above kind and it was a thoroughly enjoyable experience.

If you don’t have a TV or a HDMI monitor lying around (i.e., if you’re a stank cheap ass) I think you can set up a http server on the Pi and access it from anywhere within your local network. (Or, using ngrok, from anywhere in the world!)

I haven’t tried this yet, and I will update this blog when I have.