Raspberry Pi

Examples on these pages are for Raspbian Debian Wheezy

 

Links

Raspbian download
https://www.raspberrypi.org/downloads/raspbian/

Beginners guide
http://www.neil-black.co.uk/raspberry-pi-beginners-guide#.VdgYiJckSSc

Picture on boot
http://www.marek.tokyo/2015/02/custom-boot-splash-screen-raspberry-pi.html
Edit command:

sudo nano /etc/init.d/asplashscreen


Copy files to Raspberry Pi via SSH
download http://sourceforge.net/projects/winscp/
setup http://www.raspberry-projects.com/pi/software_utilities/transfering-files-from-windows-pcs

SD card formater
https://www.sdcard.org/downloads/formatter_4/eula_windows/index.html

Startup mailer
https://gist.github.com/johnantoni/8199088

Play mp3 on boot
http://flipdot.org/blog/index.php?/archives/212-IP-via-audio-for-Raspberry-Pi.html

Post request
http://www.learn2crack.com/2014/03/raspberry-pi-post-get.html

Scripts

Get ip

import socket
import fcntl
import struct

def get_ip_address(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(
        s.fileno(),
        0x8915,  # SIOCGIFADDR
        struct.pack('256s', ifname[:15])
    )[20:24])

get_ip_address('eth0')  # '192.168.0.110'

Start python script on LXDE startup

Edit autostart file with nano.
(this has changed in Debian Wheezy. In the old versions it was /etc/xdg/lxsession/LXDE/autostart)

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Add script to autostart. In this example ‘test.py’ is in the folder ‘code’.

@midori
@python /home/pi/code/test.py