> arp -a
$ sudo raspi-config
$ sudo apt-get install libpng12-dev
$ wget https://github.com/AndrewFromMelbourne/raspi2png/archive/master.zip
$ unzip master.zip
$ cd raspi2png-master/
$ make
$ sudo cp raspi2png /usr/local/bin/
$ sudo vi /boot/config.txt
#hdmi_force_hotplug=1
#hdmi_drive=2
#framebuffer_width=1280
#framebuffer_height=720
$ sudo reboot
$ startx
$ sudo apt-get install matchbox-keyboard
$ sudo apt-get install samba
$ sudo vi /etc/samba/smb.conf
$ mkdir /home/pi/share
$ sudo service samba restart
$ sudo update-rc.d samba defaults
$ sudo update-rc.d ssh defaults
$ sudo vim /etc/samba/smb.conf
[share]
path=/home/pi/share
read only=no1
browsable=yes
guest ok = yes
force user = pi
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
$ sudo /etc/network/interfaces
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
sdtv_mode=1
hdmi_force_hotplug=0
$ tvservice -s
state 0x40002 [NTSC 4:3], 720x480 @ 60.00Hz, interlaced
PinNo | PinNo | ||
---|---|---|---|
1 | 3.3V | 2 | 5V |
3 | GPIO2(I2C1_SDA) | 4 | 5V |
5 | GPIO3(I2C1_SCL) | 6 | GND |
7 | GPIO4(GPCLK0) | 8 | GPIO14(UART_TXD) |
9 | GND | 10 | GPIO15(UART_RXD) |
11 | GPIO17 | 12 | GPIO18 |
13 | GPIO27 | 14 | GND |
15 | GPIO22 | 16 | GPIO23 |
17 | 3.3V | 18 | GPIO24 |
19 | GPIO10(SPI_MOSI) | 20 | GND |
21 | GPIO9(SPI_MISO) | 22 | GPIO25 |
23 | GPIO11(SPI_SCLK) | 24 | GPIO8(SPI_CE0) |
25 | GND | 26 | GPIO7(SPI_CE1) |
27 | ID_SD | 28 | ID_SC |
29 | GPIO5 | 30 | GND |
31 | GPIO6 | 32 | GPIO12 |
33 | GPIO13 | 34 | GND |
35 | GPIO19 | 36 | GPIO16 |
37 | GPIO26 | 38 | GPIO20 |
39 | GND | 40 | GPIO21 |
$ ls /sys/class/gpio/
export gpiochip0 unexport
$ sudo echo 24 > /sys/class/gpio/export # GPIO24の仮想ファイルを生成
$ sudo echo out > /sys/class/gpio/gpio24/direction # GPIO24を出力に設定
$ sudo echo 0 > /sys/class/gpio/gpio24/value # GPIO24に0出力
$ sudo echo 1 > /sys/class/gpio/gpio24/value # GPIO24に1出力
$ sudo echo 24 > /sys/class/gpio/unexport # GPIO24の仮想ファイルを破棄
$ git clone git://git.drogon.net/wiringPi
$ cd wiringpi
$ ./build
$sudo apt-get install git-core
$ gpio -v
gpio version: 2.26
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Model B+, Revision: 1.2, Memory: 512MB, Maker: Sony
$ gpio readall
+-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5V | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | OUT | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | OUT | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 0 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
$ gpio -g mode 24 out # GPIO24を出力に設定
$ gpio -g write 24 0 # GPIO24に0出力
$ gpio -g write 24 1 # GPIO24に1出力
#include <stdio.h>
#include <wiringPi.h>
// LED Pin - wiringPi pin 5 is BCM_GPIO 24.
#define LED 5
int main (void)
{
printf ("Raspberry Pi blink\n") ;
wiringPiSetup () ;
pinMode (LED, OUTPUT) ;
for (;;)
{
digitalWrite (LED, HIGH) ; // On
delay (500) ; // mS
digitalWrite (LED, LOW) ; // Off
delay (500) ;
}
return 0 ;
}
$ gcc blink.c -o blink -L/usr/local/bli -lwiringPi -lwiringPiDev -lpthread -lm
$ sudo ./blink
$ sudo apt-get install libi2c-dev
i2c-dev
#blacklist i2c-bcm2708
$ sudo reboot
$ dmesg | grep i2c
[ 5.436821] bcm2708_i2c_init_pinmode(1,2)
[ 5.550985] bcm2708_i2c_init_pinmode(1,3)
[ 5.557629] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[ 12.069793] i2c /dev entries driver
$ sudo i2cdetect -l
i2c-1 i2c bcm2708_i2c.1 I2C adapter
$ sudo i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
$ sudo i2cset -y 1 0x3f 0x4d 0x53 0x47 0x61 0x69 0x75 0x65 0x6f i
$ sudo i2cset -y 1 0x3f 0x4d 0x53 0x47 0x6f 0x6e 0x6e 0x73 0x65 0x69 0x67 0x6f 0x75 0x73 0x65 0x69 0x6e 0x6f 0x2f 0x74 0x65 0x73 0x75 0x74 0x6f 0x63 0x68 0x75 0x2d 0x64 0x65 0x73 0x75 0x2e i
$ sudo i2cset -y 1 0x3f 0x4d 0x53 0x47 0x6f 0x6e 0x6e 0x73 0x65 0x69 0x67 0x6f 0x27 0x75 0x73 0x65 0x69 0x6e 0x6f 0x2f i
$ sudo i2cset -y 1 0x3f 0x4d 0x53 0x47 0x74 0x65 0x73 0x75 0x74 0x6f 0x63 0x68 0x75 0x2d 0x64 0x65 0x27 0x73 0x75 0x2e i
pi@raspberrypi ~ $ sudo apt-get install samba
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
pi@raspberrypi ~ $ sudo reboot
sudo: unable to execute /sbin/reboot: Input/output error