Step 1: What Are We Going to Do in This Project
I've been working with the Raspberry Pi 2 for about a month now, and when I got it I knew I want to control it, via a website from a mobile phone or computer.
I finally got the chance to find the easiest way to do this, it only needs a Raspberry Pi 2 (of course), resistor, led and an internet connection.
Let's get into it!
Step 2: Connecting the Raspberry Pi, Resistor, LED
When you get the resources, you sit down, and start connecting.
I have attached an image so it's easier for you.
As I mentioned in the previous step, the breadboard is there just for testing, it's okay if you just attach the LED and the resistor to the pins. (Do it on your own risk)
How do we attach a simple LED to our Raspberry Pi?
It's very easy.
You need to determine the + and - of your LED. This is very IMPORTANT
To determine which is + and which is - you look at the length of the "legs" of the LED.
The LONGER is the + and the SHORTER is the -
Find more about this on: https://learn.sparkfun.com/tutorials/polarity/diod...
Now, get your LED and put it in your breadboard and with a jumper cable, connect the + to a GPIO (in the code I'm using GPIO 21, but you can use another GPIO, but don't forget to change it in the code later)
Connect the resistor on the - on your LED and the other side in a free slot of the breadboard.
As you can see on the picture, a resistor has color codes, and at the end is a golden color code.
The golden color code goes into the breadboard, NOT into the - of the LED.
Now connect the resistor to a GND (ground) pin on your Raspberry Pi to close the circuit as shown on the picture!
Congrats, you connected an LED and a resistor to your Raspberry Pi