Raspberry Pi Log Book first created 15/02/14 - last modified 17/02/14 Page Author Ty Harness
Hello All, Some basic information for Raspberry Pi beginners. There's a huge community out there. I'm using Raspbian'Wheezy' I wrote this page as a log book for myself because I tend to forget what I've learnt but it might be useful for others.

Raspbian Jesse is out and I've written a page on it: Rpi0 and Jesse
Some basic Linux commands to remember:

Type them from the console or from an XTerm window

Use the man command for more help with switches e.g. man ls {enter}
BASH Shell: use the up arrow key to go back through the history of commands used which saves a lot of typing. Also Shift Page UP and Down if you run out of lines for all the information.


passwd {enter} Change user password (Default Raspian username pi and pw raspberry)
sudo raspi-config {enter} Various Raspian configuration such as Locale, Keyboard, Enableing the Camera and SSH etc.
sudo apt-get install xrdp {enter} Running headless

sudo apt-get update {enter}

sudo apt-get install upgrade {enter}

sudo apt-cache search XXXXXX {enter}

sudo apt-get install XXXXXXX {enter}

sudo apt-get remove XXXXXXXX {enter}

sudo apt-get purge XXXXXXXXX {enter}

sudo su {enter} Some operations need to performed by the super user

Networking
ifconfig {enter}

sudo nano /etc/network/interfaces {enter}
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1


sudo nano /etc/resolve.conf {enter}

cd / {enter} change directory to the root directory
cd {enter} change directory to the home directory
ls {enter} list directory contents
mkdir _name {enter} make a directory
rmdir _name {enter} remove a directory
rm _name {enter} remove file called _name
mv oldfilname newfilename {enter} rename a file
ps {enter} kill {enter}
startx {enter} Start Xwindows
sudo halt {enter} shutdown the Pi immediately
sudo reboot {enter} reboot the Pi immediately
Forgot your password with Noobs
raspberrypi.org Plug USB keyboard into PI and connect to TV. Hold shift key down and power up.
Choose Raspian:
e for edit
arrow right for command.txt
add space and 1 to end of line to read
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait 1
OK
Escape to exit and wait for boot process to fnish and enter
sudo passwd pi give yourself and new password. startup again in recovery mode and remove the 1 from command .txt

RPi Hardware
cat /proc/cpuinfo {enter}
0002 Model B Revision 1.0
0003 Model B Revision 1.0 + ECN0001 (no fuses, D14 removed)
0004 -- 000f Model B Revision 2.0
hex codes relate to date of release and manufacturer
elinux.org/RPi_HardwareHistory

USB Flash drive
Using a usb flash drive formated VFAT
House keeping:
sudo mkdir /media/usbhdd{enter}
sudo chown pi:pi /media/usbhdd {enter}


to mount the device:
sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/usbhdd
to un mount the device:
sudo umount /media/usbhdd
Tested Hardware
Emprex wireless keyboard and joystick Model 9019URF3 : OK

text here
Emprex Wireless Keyboard Model 9019URF3


Xenta USB wired Chiclet Keyboard Model SK-094 : OK


I only needed a keyboard and HDMI TV to run up the RPi and set up the networking and remote access. Running headless works pretty well. www.howtogeek.com - Remote Shell

CAD


text here
Figure XX - 2D Plans and Elevations drawn in TurboCAD20Deluxe


Model B PDF scale 1:1
Model B DXF scale 1:1

Raspberry Pi Camera Module
From a terminal window:
raspistill -o img1.jpg -t 100 {enter} Take simple snap in 100ms leave off -t then it takes 5000ms by default
raspistill -o img%04d.jpg -t 5000 -tl 1000 {enter} Take 5 shots 1 every second for 5 seconds ideal for time lapse photography

raspberrypi.org/help/camera-module-setup
See below in C Programming for how to control the camera programatically
C Programming

House Keeping: cd {enter} - goto home directory
mkdir mywork {enter} - make a new directory
cd mywork - change working directory to mywork
pico raspberryhello.c {enter} - Just noticed I typed pico but I got the nano text editor!

text here text here
Figure XXa - Nano editor
Figure XXb - Run the compiled file by typing ./hello


Ctrl X
Y to save
enter to accept raspberryhello.c filename
gcc -o hello raspberryhello.c {enter}. - Compile the source file
./hello {enter} - Run the compiled file.

C is a good programming choice for the Raspberry Pi. It's extremely difficult language to master but small programs can be so simple - here's a more exciting example of making a programmable digital camera for under 50 by combining the Rpi and RpiCamera. You would have spent 100s on hardware and software a few years back. When I was at college an image capture board was serious money.



text here
Figure XX - Using a program to control the RaspiCam



C++ Programming

The GNU C++ is not part of the Raspian Distro. to date therefore:
sudo apt-get install gpp {enter].

pico raspberryhello.cpp {enter} Use pico to write the source files

text here text here
Figure XX - Run the compiled file by typing ./helloCpp





Pascal
sudo apt-get update {enter}
sudo apt-get upgrade {enter}
sudo apt-get install fpc {enter} to install the Free Pascal Compiler FPC

type:
fp {enter} to launch the FP IDE (nostalgic nod to Turbo Pascal but you can use nano if you prefer)

text here text here
Figure XX - Type is your pascal source into the FP IDE


You can run the code from the IDE and return to the IDE if you like or Build into a standalone application using Compile then Build and then type:
./pascalhello {enter} to run the application.

text here
Figure XX - ./pascalhello {enter}


Looks like you need to mkdir for each pascal app you write just to take care of the house keeping. I find it easier to use nano for editing the source files and use another terminal with command line compiler --> fpc PascalHello.pas and then if successful run the binary with -->./PascalHello

elinux.org/Free_Pascal_on_RPi
elinux.org/Lazarus_on_RPi
Java .raspberrypi.org/blog/oracle-java-on-raspberry-pi/

sudo apt-get update && sudo apt-get install oracle-java7-jdk
Python
When I went to college Pascal was the choice for beginners but it looks like Python may be best choice for instructors and students for the Raspberry Pi.
GPIO
http://elinux.org/RPi_Low-level_peripherals#Lazarus_.2F_Free_Pascal
Gertboard
PicAxe
http://www.instructables.com/id/PICAXE-Raspberry-Pi-ADC/
http://www.picaxe.com/
References
www.raspberrypi.org/
http://www.neil-black.co.uk/raspberry-pi-beginners-guide
projects.drogon.net/
www.themagpi.com/