Initial Setup

Reset Your Password

Since all Raspian images come with the same password, you'll need to change the root password so no one can access it without your approval:

* At the terminal, run ``sudo raspi-config``
  * Choose the ``change_pass`` menu option & enter a new password

Configuring Your Keyboard

By default, the Raspian image uses a English UK keyboard setup, which can lead to some confusion. For those in the US, following the following steps to fix the keyboard:

* At the terminal, run ``sudo raspi-config``
  * Choose the ``configure_keyboard`` menu option
    * Other
    * English (US)
    * English (US) - yes, again

Additionally, if you like using the ``Caps Lock`` as ``Ctrl`` instead, run the following command:

* ``setxkbmap -option "ctrl:nocaps"``


To make sure things are in order, reboot your RaspberryPi. This is typically only necessary if you alter the video memory setup or use the entire SD card for the Raspian setup.

* ``sudo reboot``

Python Packaging

While the RaspberryPi (& Raspian) run Python out-of-the-box, you'll likely want some common packaging tools for more advanced development. The following gets you some common Python tools (``pip`` for easy installation/removal of packages & ``virtualenv`` for nice isolated environments):

* ``sudo apt-get install python-dev``
* ``curl -O``
* ``sudo python``
* ``sudo pip install virtualenv``

Your First RaspberryPi Program: Blinken

At a terminal, run the following commands to setup an environment for blinking an LED:

* ``mkdir blinken``
* ``cd blinken``
* ``virtualenv env``
* ``. env/bin/activate``
* ``pip install rpi.gpio``

Then run an editor (ex. ``vi``) & enter the following code:

    # Code goes here.
    import RPi.GPIO as GPIO
    import time
    # Variable for the GPIO pin number
    LED_pin_red = 21
    # Tell the Pi we are using the breakout board pin numbering

    # Set up the GPIO pin for output
    GPIO.setup(LED_pin_red, GPIO.OUT)

    # Loop to blink our led
    while True:
        GPIO.output(LED_pin_red, GPIO.HIGH)
        GPIO.output(LED_pin_red, GPIO.LOW)

* Heitz, Ryan. Hello Raspberry Pi! ( Manning Publications (2015). p.p. 225. ISBN 9781617292453