since: 2016/09/07
update: 2017/04/11
reference:
1. Omxplayer
2. How To Mount A USB Flash Disk On The Raspberry Pi
3. Playing Audio
4. A security update for Raspbian PIXEL - Raspberry Pi
5. ModMyPi | How to give your Raspberry Pi a Static IP Address
A. omxplayer
1.
開機時(設定自動登入), 自動播放 loop 影片
$
cd
$
sudo nano .bashrc
......
# start omxplayer
echo "tty = $(tty)"
if [ $(tty) == "/dev/tty1" ]; then
echo "We have a match."
cd
omxplayer -o hdmi --no-osd --win 0,0,1920,1080 --loop SenzaPeso.mp4
#omxplayer -o local --no-osd --win 0,0,1920,1080 --loop SenzaPeso.mp4
#omxplayer -p -o local --no-osd --win 0,0,1920,1080 --loop SenzaPeso.mp4
#omxplayer -p -o hdmi --no-osd --win 0,0,1920,1080 --loop SenzaPeso.mp4
#omxplayer --nativedeinterlace SenzaPeso.mp4
else
echo "We dont match."
fi
說明: 聲音輸出經由 HDMI:
-o hdmi
聲音輸出經由本地:
-o local
影片格式: 建議
.mp4,
.mkv
2.
強制 HDMI 輸出
$
sudo nano /boot/config.txt
....
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
hdmi_drive=2
....
-----------------------------------------------------------------------------------------------
B. Mount A USB Flash Disk
$ cd
$ sudo fdisk -l // you can find some thing like: /dev/sda1
$ sudo mkdir /media/usb
$ sudo chown -R pi:pi /media/usb
$ sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi
// umount
$ umount /media/usb
-----------------------------------------------------------------------------------------------
C. Audio
1. creating a tone
$ speaker-test -t sine -f 60 > /dev/null
2.
text to speech
$
sudo apt-get install espeak
$
espeak "Hello World" > /dev/null
3.
playing a .wav file
$ cat ./aplay.sh
#!/bin/bash
while [ 1 ] ; do
aplay oceano.wav
#sleep 5
done
-----------------------------------------------------------------------------------------------
D. Enable SSH Login for Raspbian-Pixel
=> 當將影像檔燒到 SD 卡後, 新增一個 ssh 檔案(內容可以空白或任意),
將此 ssh 檔案 copy 到 SD 卡根目錄裡(即 boot 下), 接著將 SD 卡放入 Pi 開機.
備註: To update your existing Jessie image with all the bug fixes and these
new security changes, type the following at the command line:
$
sudo apt-get update
$
sudo apt-get dist-upgrade
$
sudo apt-get install -y pprompt
-----------------------------------------------------------------------------------------------
E. Raspberry Pi: fixed ip address
$ sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.bak
$ sudo nano /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.1.2/24
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 $ sudo reboot
$ ifconfig