raspberry pi - havasi.sed.hu · /boot/config.txt # set stdv mode to pal (as used in europe)...

20
Raspberry Pi Havasi Ferenc SZTE Szoftverfejlesztés Tanszék

Upload: others

Post on 15-Mar-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

Raspberry PiHavasi Ferenc

SZTE Szoftverfejlesztés Tanszék

Page 2: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

Miről lesz szó?

● Raspberry Pi hardveres tulajdonságai● Szoftveres lehetőségei (röviden)

– Operációs rendszerek

– Konfigurálása

● Áramkörök vezérlése (hosszabban)– Led

– Hőszenzor

– Kamera

Page 3: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 4: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 5: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

Ár 25$ / 35$

Chipkészlet Broadcom BCM2835 (CPU, GPU, DSP, SDRAM, USB)

CPU 700 MHz ARM1176JZF-S core (ARM11 family, ARMv6)

GPU Broadcom VideoCore IV @ 250 MHz[77][78]OpenGL ES 2.0 (24 GFLOPS)MPEG-2 and VC-1 (license), 1080p30 h.264/MPEG-4 AVC high-profile decoder and encoder

SDRAM 256M / 512M

USB 1 / 2 db USB 2.0

Videó bemenet A CSI input connector allows for the connection of a RPF designed camera module

Videó kimenet Composite RCA, HDMI , raw LCD

Hang kimenet 3.5 mm jack, HDMI

Háttértár SD / MMC / SDIO card slot

Al. perifériák 8 × GPIO, UART, I²C bus, SPI bus with two chip selects, I²S audio

Méret, súly 85.60 × 53.98 mm , 45g

Page 6: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 7: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 8: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 9: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

/boot/config.txt

# Set stdv mode to PAL (as used in Europe)sdtv_mode=2# Force the monitor to HDMI mode so that sound will be sent over HDMI cablehdmi_drive=2# Set monitor mode to DMThdmi_group=2# Set monitor resolution to 1024x768 XGA 60Hz (HDMI_DMT_XGA_60)hdmi_mode=16# Make display smaller to stop text spilling off the screenoverscan_left=20overscan_right=12overscan_top=10overscan_bottom=10

http://elinux.org/RPiconfig

Page 10: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 11: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

http://elinux.org/Rpi_Low-level_peripherals

3.3 V és 50mA

Page 12: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 13: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

# Set up GPIO 4 and set to outputecho "4" > /sys/class/gpio/exportecho "out" > /sys/class/gpio/gpio4/direction

# Set up GPIO 7 and set to inputecho "7" > /sys/class/gpio/exportecho "in" > /sys/class/gpio/gpio7/direction

# Write outputecho "1" > /sys/class/gpio/gpio4/value

# Read from inputcat /sys/class/gpio/gpio7/value

# Clean upecho "4" > /sys/class/gpio/unexportecho "7" > /sys/class/gpio/unexport

Page 14: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

import sysimport RPi.GPIO as GPIO

pin = int(sys.argv[1])value = int(sys.argv[2])

GPIO.setmode(GPIO.BCM)GPIO.setup(pin, GPIO.OUT)GPIO.output(pin,value)

Page 15: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

#!/usr/bin/python# Usage: switch_read.py pinnumber# - pinnumber: number of pin where the switch+ground are # connected

importimport sysimportimport RPi.GPIO as GPIO

pin = intint(sys.argv[1])GPIO.setmode(GPIO.BCM)GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)value = GPIO.input(pin)print valueGPIO.cleanup()sys.exit(0)

Page 16: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable
Page 17: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

#!/usr/bin/python## Usage: switch_wait.py pinnumber# - pinnumber: numbe of pin where the switch+ground are connected## The script will wait until the button will pressed. (and print + char)# Does not waste resources.

importimport sysimportimport RPi.GPIO as GPIO

pin = intint(sys.argv[1])GPIO.setmode(GPIO.BCM)GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)trytry: GPIO.wait_for_edge(pin, GPIO.FALLING) printprint "+"exceptexcept KeyboardInterrupt: GPIO.cleanup() printprint "0" sys.exit(2)GPIO.cleanup()sys.exit(0)

Page 18: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

modprobe w1-gpiomodprobe w1_therm

/sys/bus/w1/devices/28-*/w1_slave

Hőszenzor

Page 19: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

● http://www.raspberrypi.org/camera ● fekete nyák = éjszakai használat (infra)● legújabb raspbian● sudo raspi-config → enable camera● raspistill -o image.jpg● raspivid -o video.h264● demo: -d

Page 20: Raspberry Pi - havasi.sed.hu · /boot/config.txt # Set stdv mode to PAL (as used in Europe) sdtv_mode=2 # Force the monitor to HDMI mode so that sound will be sent over HDMI cable

Köszönöm a figyelmet! :)