Introduzione a RaspBerry PI

Post on 13-May-2015

2,425 views 3 download

description

Presentazione introduttiva al RaspBerry PI

transcript

Raspberry Pi

Paolo Aliverti

- Panoramica- Sistema Operativo- Hardware- Come lo programmo- Physical Computing & Iot

Non è...

Non è...

Cos'è?

Cos'è?

Perchè?

Perchè?

Oggi abbiamo questi...

Cosa abbiamo perso?

Era l'anno 2006...

Eben Upton

Rob Mullins, Jack Lang and Alan MycroftUniversità di Cambridge

Nasce per loro...

Poi lo scopre lei...

Che lo dice a lui...

Che lo dice a loro!

1.000.000 unità12 mesi

Raspberry Pi

1. Panoramica

BroadCom700Mhz256 o 512 Mb

Advanced RISC

Machine

1. Alimentazione700mA

2. SDclasse 4 4Mb/s

3. USB500mA MAX

4. HDMI14 risoluzioni

5. VideoPAL/NTSC

6. Audio AnalogicoHi Z

7. Ethernet

8. GPIOGeneral Purpose Input & Output3.3V

9. LED

10. DSIDisplay Serial Interface

11. CSICamera Serial Interface

Raspberry Pi

1. Sistema operativo

Raspbian

AlternativeSoft-float Raspbian wheezy – usa la più lenta soft-float ABI. Pensata per essere usata con sw tipo la JVM di Oracle che non supporta la hard-float della raspbian ufficiale

Arch Linux ARM – basata su Arch Linux che offre semplicità e contollo totale. Richiede una certa conoscenza di linux e un po' di esperienza. Si avvia in 10 secondi

RISC OS – è un sistema operativo sviluppato dalla ACORN. Nato nel 1987, di proprietà della Castle Technology e mantenuto dalla RISC OS Open. La versione è stata liberamente messa a disposizione degli utenti del raspberry.

Android 4http://androidpi.wikia.com/

Copia del file iso sulla SD

Copia del file iso sulla SD

dd bs=1m if=wheezy-raspbian.img of=/dev/rdisk3

Setup

E' linux!

startx

LXDE

WIFI

Putty e VNC

sudo apt-get install tightvncserver

synaptic

Raspberry Pi

1. Hardware

3.3V

Scripting

/sys/class/gpio

Scripting

echo 25 > export

Scripting

cd gpio25

Scripting

echo out > direction

Scripting

echo 1 > valueecho 0 > value

Scripting

echo 23 > export

Scripting

echo in > direction

Scripting

cat value

import RPi.GPIO as GPIOimport time

GPIO.setup(3, GPIO.OUT)

GPIO.setup(3, GPIO.IN)

GPIO.output(3, GPIO.HIGH)

GPIO.output(3, GPIO.LOW)

GPIO.input(24)

time.sleep(.1)

Hello World!

# Hello World

import RPi.GPIO as GPIOimport time

#BCM per le label; BOARD per la piedinatura fisicaGPIO.setmode(GPIO.BCM)

GPIO.setup(3, GPIO.OUT)

while True:GPIO.output(3, GPIO.HIGH)time.sleep(1)GPIO.output(3, GPIO.LOW)time.sleep(.5)

Raspberry Pi

1. WebCam & Internet

Physical Computing

building interactive physical systems by the use of software and hardware that can sense and respond to the analog world

Tangible User Interface

Internet?

import urllibimport urllib2

service = urllib2.urlopen("http://www.google.it/")webpage = service.read()print(webpage)

void setup() { Serial.begin(9600); pinMode(13, OUTPUT);}

void loop() { int n = Serial.read(); if ((char)n == 'a') { digitalWrite(13, HIGH); } if ((char)n == 's') { digitalWrite(13, LOW); }}

Sketch Arduino

import serial

port = "/dev/ttyACM0"

arduino = serial.Serial(port, 9600)

arduino.flushInput()

while True:

str = raw_input(">:")

if (str == "q"):

break

print str

arduino.write(str)

Python per RBPi

A ottobre...

Raspberry Pi

Paolo Aliverti@zeppelinmaker