Basic setting
Auto-start
Use sudo crontab -e
to set autostart programme
@reboot python /home/pi/MyScript.py &
This tells Cron that every boot (or reboot or start-up) we want to run Python with the script MyScript.py. The “&” at the end of the line means the command is run in the background and it won’t stop the system booting up as before.
To kill the job
ps aux | grep /home/pi/MyScript.py
sudo kill pid_show_in_ps
Python library
Pin
- GPIO: Models A+, B+, Raspberry Pi 2 B and Raspberry Pi 3 B - Raspberry Pi Documentation
- Sense HAT at Raspberry Pi GPIO Pinout
- Raspberry Pi GPIO Pinout
Examples
- Project 1: GPIO Led using Python
- Intro to Raspberry Pi GPIO - YouTube
- Raspberry Pi For Beginners: LED Connections, Bread-boards, and Programming - YouTube
- ModMyPi | HC-SR04 Ultrasonic Range Sensor on the Raspberry Pi
Links
- How to make a DIY Raspberry Pi Arcade Cabinet! - YouTube
- PSP Raspberry PI 3 HDMI LCD RetroPie PSPi - YouTube
- 淺談電路板 micro:bit vs Arduino vs Raspberry Pi淺談電路板 micro:bit vs Arduino vs Raspberry Pi - PCM
- USB (DWC) Enumeration ? - Raspberry Pi Forums
- Simple guide for setting up OTG modes on the Raspberry Pi Zero
- Raspberry Pi – Basic Setup without Monitor and Keyboard (Headless Setup)
- 5 Amazing Gadgets Built On Raspberry Pi - YouTube
Some Projects
- Projects | Raspberry Pi Projects
- Top 10 Coolest Raspberry Pi Projects - YouTube
- Top 10 Raspberry Pi Projects for Beginners
- DIY Raspberry Pi Indoor Outdoor Webcam: 9 Steps (with Picturesres)
- Daylight IR photography - Raspberry Pi Forums
- Plug and Play IoT with the Pi Sense HAT
- The Simplest Way to Build A Raspberry Pi-Powered Amazon Echo
- Raspberry Pi · alexa/alexa-avs-sample-app Wiki
- Control Raspberry Pi GPIO With Amazon Echo and Python: 11 Steps (with Pictures)
- MagicMirror²
- Raspberry Pi Based Line Follower Robot with Python Code
- RetroPie
- A fun, hands-on deep learning project for beginners, students, and hobbyists - PyImageSearch
- Top 8 IDEs for Raspberry Pi - Open Source For You
- Build Actuator app for controlling Illumination with Raspberry Pi 3 | Packt Hub
- piPrint: Raspberry Pi 3D Printer - YouTube
- 10+ Classic Games You Can Run on Raspberry Pi Without Emulators
- STICKY: GAMES LIST: Games That Work On The Pi - Raspberry Pi Forums
- 避開emulator, apt-get 到通常licence 都okay, 可以去project homepage 睇睇
- recommend Pydance, DOOM/Quake
- Raspberry Pi - Blynk - YouTube
Some thoughts
“Blinking LED” is just like writing an “hello world” programme in physical computing.
Sensors
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor
GPIO.setup(18, GPIO.OUT) #LED output pin
while True:
i=GPIO.input(11)
if i==0: #When output from motion sensor is LOW
print "No intruders",i
GPIO.output(18, 0) #Turn OFF LED
time.sleep(0.1)
elif i==1: #When output from motion sensor is HIGH
print "Intruder detected",i
GPIO.output(18, 1) #Turn ON LED
time.sleep(0.1)
Others
Using Raspberry Pi to control servo
- Usng Pulse modulation to control a servo
- Servo control using Raspberry Pi. - YouTube
- RPi.GPIO 0.5.2a now has software PWM – How to use it – RasPi.TV
- Pulse Width Modulation Used for Motor Control
Sensor HAT
- Home - Sense HAT
- Sense HAT - Raspberry Pi Documentation
- Getting started with the Sense HAT | Raspberry Pi Projects
ADC (Analog to Digital Convertor)
Reference
- 用Raspberry Pi學GPIO - 自己做遊戲機
- Raspberry Pi Documentation
- VNC (Virtual Network Computing) - Raspberry Pi Documentation
- SSH (Secure Shell) - Raspberry Pi Documentation
- Passwordless SSH access - Raspberry Pi Documentation
- Ethernet Gadget | Turning your Raspberry PI Zero into a USB Gadget | Adafruit Learning System
- Time-lapse animations with a Raspberry Pi - Adding a delay | Raspberry Pi Projects