Popular Raspberry Pi Commands - Summary
raspistill -o Desktop/image.jpg
-> Captures a still image using the Raspberry Pi Camera Module.
raspistill -o Desktop/image-small.jpg -w 640 -h 480
-> Captures a smaller-sized image by specifying width and height.
raspivid -o Desktop/video.h264
-> Records a video using the Camera Module.
from picamera import PiCamera
-> Imports the PiCamera library in Python.
camera = PiCamera()
-> Initializes the camera object.
camera.start_preview(), camera.stop_preview()
-> Starts and stops the camera preview window.
camera.capture('/home/pi/Desktop/image.jpg')
-> Captures a still image and saves it to Desktop.
camera.rotation = 180
-> Rotates the camera preview/image.
camera.start_recording('video.h264'), camera.stop_recording()
-> Starts and stops video recording using Python.
import RPi.GPIO as GPIO
-> Imports the GPIO library for Raspberry Pi.
GPIO.setmode(GPIO.BCM) or GPIO.setmode(GPIO.BOARD)
-> Sets pin numbering mode (BCM or BOARD).
GPIO.setup(pin, GPIO.OUT or GPIO.IN)
-> Sets a GPIO pin as input or output.
GPIO.output(pin, state)
-> Sets a GPIO pin to HIGH or LOW.
GPIO.input(pin)
-> Reads input value from a GPIO pin.
GPIO.setwarnings(False)
-> Disables GPIO warnings.
socket.socket()
-> Creates a socket for client/server communication.
socket.bind((host, port))
-> Binds server to a host IP and port.
socket.listen(5)
-> Listens for incoming client connections.
socket.connect((host, port))
-> Client connects to the server.
socket.recv(1024), socket.send(data)
-> Receives or sends data over network sockets.