raspberry pi + python

Post on 14-May-2015

5.287 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Raspberry Pi + Python

Daker Fernandes Pinheiro (dakerfp)

Novembro/2012, Python Brasil [8] - Rio de Janeiro / RJ

$ whois dakerfp

� Daker Fernandes Pinheiro

� Ciência de Computação pela UFPE - Recife/Brasil

� 2010 - Instituto Nokia de Tecnologia

� Qt, KDE, ...

O que é?

The Raspberry Pi is a credit-card sized computer thatplugs into your TV and a keyboard. It's a capable littlePC which can be used for many of the things that yourdesktop PC does, like spreadsheets, word-processing andgames. It also plays high-de�nition video. We want tosee it being used by kids all over the world to learnprogramming.

� Barato!

� http://raspberrypi.org/

O que posso fazer?

Raspberry Pi vs Arduino

Arduino� Sentir e Controlar o mundo físico� + Sinais Digitais� + Conversor ADC onboard� + Shields

Raspberry Pi + Arduino

� Bridge� Arduino to RPi shields� Gertboard

Como obter?

� Modelo A (256MB) - US$25

� Modelo B (512MB) - US$30

� Farnell: http://www.farnell.com/

� RS Components: http://uk.rs-

online.com/web/generalDisplay.html?id=raspberrypi

� + Fonte Micro USB

� + Cartão SD

Valeu Brasil!

� >R$150,00

� Câmbio

� Frete Internacional

� Imposto Alfendegário

� ICMS

� INFRAERO

� Taxas Administrativas

� ...

Setup

� Download de imagemhttp://www.raspberrypi.org/downloads

� Raspbian� ArchLinux� RISC OS

� $ dd if=imagem.img of=/dev/cartao-sd ||Win32DiskImager

� Encaixe o cartão SD na RPi

� Encaixe a fonte mini USB na força || 4 pilhas

� Redimensione o espaço utilizado

� Have fun!

Util

� user: pi password: raspberry

� startx

� shutdown -h 0

� dhclient

Python on the Pi

Por quê?

� Didático

� Fácil

� Compilação

� Cross Compilação (arm)

� Divertido

Raspbian

� IDE inclusa

� Exemplos

� Divertido

Bibliotecas Grá�cas

� PySide

� PyQt

� PyGTK

� PyGame

� Kivy

� pycairo

� pye�

� PySDL

� ...

Aceleração grá�ca

� OpenGL vs OpenGL ES

� OpenGL ES 2: pogles

� OpenMAX: gst-openmax

� Conheça sua API grá�ca

� X.org free: RPi_Vid_Core:https://bitbucket.org/bryancole/rpi_vid_core/wiki/Home

� WIP: Wayland

IO

� Seu framework favorito :-)� X.org free:

� evdev: pyglet� GPIO: RPi.GPIO

IO

� High: 3.3V Low: 0V� Não é 5V tolerant� Não há proteção contra super-voltagem

Dicas

� Evite threads, event loops resolvem

� Python é bom para prototipar, mas não temperformance con�ável em embarcados

� Use o X.org apenas se necessário

� Pense OpenGL ES 2

� Minimize uso de CPU

� Delegue mais funções para APIs implementadas emC

� Faça pro�le antes de otimizar

� Otimize algoritmos antes de escovar bits

Duvidas?

http://codecereal.blogspot.comhttp://raspberrypi.org

http://www.elinux.org/R-Pi_Hub@dakerfp

freenode dakerfp

Daker Fernandes Pinheiro (dakerfp)daker.pinheiro@openbossa.orghttp://www.anselmolsm.org

top related