SlideShare a Scribd company logo
Raspberry Pi

       Frank Carver
      frankcarver.me
raspberryalphaomega.org.uk
•   ARM1176 CPU @700MHz
•   Broadcom BCM2835 chipset & GPU
•   512MB* RAM
•   USB, Ethernet, 1080p HDMI, audio
•   8 GPIO pins + UART, SPI, 12C
•   Storage on SD/SDHC Card
•   Linux, RiscOS etc. or “bare metal”

• About £25
Arduino Uno
•   ATmega328 CPU @16MHz
•   No GPU
•   32K Flash, 2K SRAM, 1K EEPROM
•   USB, no network or video
•   14 GPIO pins, 6 analogue inputs
•   No storage
•   “Bare metal” cross-compile only

• About £18
Cheap Dell PC
•   Intel CPU @2.8GHz
•   Intel HD GPU
•   2GB RAM
•   USB,Ethernet,SATA,HDMI,Wireless,…
•   No IO pins
•   500GB hard drive, DVD
•   Windows, Linux, etc.

• About £300
Software Development
Bare Metal               Linux
• Assembler              • Pretty much anything
• Cross-compiled C/C+    • Python
  + etc.                 • Ruby
• Hand-built languages   • Java
                         • perl
                         • PHP
                         • bash
                         • …
So let’s do some Ruby
So let’s do some Ruby
 Step 1: installation
So let’s do some Ruby
                     Step 1: installation

•   sudo apt-get install ruby1.9.3


                              That wasn’t so hard 
Ruby talks to hardware
File.open('/sys/class/gpio/export', 'w') { |file| file.write("17") }
File.open('/sys/class/gpio/gpio17/direction', 'w') { |file| file.write("out") }
File.open('/sys/class/gpio/export', 'w') { |file| file.write("27") }
File.open('/sys/class/gpio/gpio27/direction', 'w') { |file| file.write("out") }
File.open('/sys/class/gpio/export', 'w') { |file| file.write("22") }
File.open('/sys/class/gpio/gpio22/direction', 'w') { |file| file.write("out") }

begin

while true do
  for r in 0..1
    File.open('/sys/class/gpio/gpio17/value', 'w') { |file| file.write("#{r}") }
    for g in 0..1
      File.open('/sys/class/gpio/gpio27/value', 'w') { |file| file.write("#{g}") }
      for b in 0..1
        File.open('/sys/class/gpio/gpio22/value', 'w') { |file| file.write("#{b}") }
        sleep 1
      end
    end
  end
end

rescue SignalException
  File.open('/sys/class/gpio/gpio17/value', 'w') { |file| file.write("0") }
  File.open('/sys/class/gpio/gpio27/value', 'w') { |file| file.write("0") }
  File.open('/sys/class/gpio/gpio22/value', 'w') { |file| file.write("0") }
end
A nicer way
require "pi_piper"

pin_r = PiPiper::Pin.new(:pin => 17, :direction => :out)
pin_g = PiPiper::Pin.new(:pin => 27, :direction => :out)
pin_b = PiPiper::Pin.new(:pin => 22, :direction => :out)

begin

while true do
  for r in 0..1
    if r==1 ; pin_r.on else pin_r.off end
    for g in 0..1
      if g==1 ; pin_g.on else pin_g.off end
      for b in 0..1
        if b==1 ; pin_b.on else pin_b.off end
        sleep 1
      end
    end
  end
end

rescue SignalException
  pin_r.off
  pin_g.off
  pin_b.off
end
Another way
require "wiringpi"

io = WiringPi::GPIO.new(WPI_MODE_GPIO)

begin

while true do
  for r in 0..1
    io.write(17,r)
    for g in 0..1
      io.write(27,g)
      for b in 0..1
        io.write(22,b)
        sleep 1
      end
    end
  end
end

rescue SignalException
  io.write(17,0)
  io.write(27,0)
  io.write(22,0)
end
Input
require 'pi_piper'
include PiPiper

watch :pin => 23 do
  puts "Pin changed from #{last_value} to #{value}"
end

#Or

after :pin => 23, :goes => :high do
  puts "Button pressed"
end

PiPiper.wait
So what makes it special?
Raspberry Pi
is the gateway drug
 to microelectronics
More Fun – Ruby USB
•   wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-
    1.0.9/libusb-1.0.9.tar.bz2
•   tar xjf libusb-1.0.9.tar.bz2
•   cd libusb-1.0.9
•   ./configure
•   make
•   sudo make install

•   sudo apt-get install libusb-1.0-0-dev
•   sudo gem install libusb
Raspberry Pi for IPRUG

More Related Content

What's hot

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
Yodalee
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
DefconRussia
 
libuv: cross platform asynchronous i/o
libuv: cross platform asynchronous i/olibuv: cross platform asynchronous i/o
libuv: cross platform asynchronous i/o
Saúl Ibarra Corretgé
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
Walter Heck
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350
Takuya ASADA
 
SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]
Takuya ASADA
 
Intel IoT webinar #1 - Tedison presentation
Intel IoT webinar  #1 - Tedison presentation Intel IoT webinar  #1 - Tedison presentation
Intel IoT webinar #1 - Tedison presentation
BeMyApp
 
Ctf hello,world!
Ctf hello,world! Ctf hello,world!
Ctf hello,world!
Hacks in Taiwan (HITCON)
 
Custard pi 7 user information
Custard pi 7 user informationCustard pi 7 user information
Custard pi 7 user information
Seggy Segaran
 
今日から始めるPlan 9 from Bell Labs
今日から始めるPlan 9 from Bell Labs今日から始めるPlan 9 from Bell Labs
今日から始めるPlan 9 from Bell Labs
Ryousei Takano
 
Asphalt8.ifgiovanni
Asphalt8.ifgiovanniAsphalt8.ifgiovanni
Asphalt8.ifgiovanni
201419942010
 
GCC
GCCGCC
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time web
Andrew Fisher
 
Python with a SWIG of c++
Python with a  SWIG of c++Python with a  SWIG of c++
Python with a SWIG of c++
bobmcn
 
Internet Archive Video Presentation
Internet Archive Video Presentation Internet Archive Video Presentation
Internet Archive Video Presentation
tracey jaquith
 
Raspberry pi a la cfml
Raspberry pi a la cfmlRaspberry pi a la cfml
Raspberry pi a la cfml
ColdFusionConference
 
GStreamer 101
GStreamer 101GStreamer 101
GStreamer 101
yuvipanda
 
A deep dive into libuv
A deep dive into libuvA deep dive into libuv
A deep dive into libuv
Saúl Ibarra Corretgé
 
Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎
François Perrad
 
Overloading Perl OPs using XS
Overloading Perl OPs using XSOverloading Perl OPs using XS
Overloading Perl OPs using XS
ℕicolas ℝ.
 

What's hot (20)

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
 
libuv: cross platform asynchronous i/o
libuv: cross platform asynchronous i/olibuv: cross platform asynchronous i/o
libuv: cross platform asynchronous i/o
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350
 
SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]
 
Intel IoT webinar #1 - Tedison presentation
Intel IoT webinar  #1 - Tedison presentation Intel IoT webinar  #1 - Tedison presentation
Intel IoT webinar #1 - Tedison presentation
 
Ctf hello,world!
Ctf hello,world! Ctf hello,world!
Ctf hello,world!
 
Custard pi 7 user information
Custard pi 7 user informationCustard pi 7 user information
Custard pi 7 user information
 
今日から始めるPlan 9 from Bell Labs
今日から始めるPlan 9 from Bell Labs今日から始めるPlan 9 from Bell Labs
今日から始めるPlan 9 from Bell Labs
 
Asphalt8.ifgiovanni
Asphalt8.ifgiovanniAsphalt8.ifgiovanni
Asphalt8.ifgiovanni
 
GCC
GCCGCC
GCC
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time web
 
Python with a SWIG of c++
Python with a  SWIG of c++Python with a  SWIG of c++
Python with a SWIG of c++
 
Internet Archive Video Presentation
Internet Archive Video Presentation Internet Archive Video Presentation
Internet Archive Video Presentation
 
Raspberry pi a la cfml
Raspberry pi a la cfmlRaspberry pi a la cfml
Raspberry pi a la cfml
 
GStreamer 101
GStreamer 101GStreamer 101
GStreamer 101
 
A deep dive into libuv
A deep dive into libuvA deep dive into libuv
A deep dive into libuv
 
Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎
 
Overloading Perl OPs using XS
Overloading Perl OPs using XSOverloading Perl OPs using XS
Overloading Perl OPs using XS
 

Similar to Raspberry Pi for IPRUG

Presentazione
PresentazionePresentazione
Presentazione
Giulia Cassarà
 
Musiconlinux
MusiconlinuxMusiconlinux
Musiconlinux
Giulia Cassarà
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218
CAVEDU Education
 
Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHP
Adam Englander
 
manual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdfmanual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdf
ssuserc5ee4c
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
Tom Paulus
 
Raspberry Pi a la CFML
Raspberry Pi a la CFMLRaspberry Pi a la CFML
Raspberry Pi a la CFML
devObjective
 
Got Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOGot Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIO
Adam Englander
 
Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry Pi
Lentin Joseph
 
Democratizing the Internet of Things
Democratizing the Internet of ThingsDemocratizing the Internet of Things
Democratizing the Internet of Things
Adam Englander
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
Intel® Developer Zone Россия
 
Programming the Raspberry Pi element14
Programming the Raspberry Pi element14Programming the Raspberry Pi element14
Programming the Raspberry Pi element14
Imad Rhali
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
Jingfeng Liu
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
Seggy Segaran
 
Senior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster ComputingSenior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster Computing
Ralph Walker II
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptx
TuynLCh
 
Python on FreeBSD
Python on FreeBSDPython on FreeBSD
Python on FreeBSD
pycontw
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
Shahed Mehbub
 
Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi board
Thierry Gayet
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
ronnywang_tw
 

Similar to Raspberry Pi for IPRUG (20)

Presentazione
PresentazionePresentazione
Presentazione
 
Musiconlinux
MusiconlinuxMusiconlinux
Musiconlinux
 
[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218[5]投影片 futurewad樹莓派研習會 141218
[5]投影片 futurewad樹莓派研習會 141218
 
Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHP
 
manual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdfmanual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdf
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Raspberry Pi a la CFML
Raspberry Pi a la CFMLRaspberry Pi a la CFML
Raspberry Pi a la CFML
 
Got Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOGot Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIO
 
Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry Pi
 
Democratizing the Internet of Things
Democratizing the Internet of ThingsDemocratizing the Internet of Things
Democratizing the Internet of Things
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 
Programming the Raspberry Pi element14
Programming the Raspberry Pi element14Programming the Raspberry Pi element14
Programming the Raspberry Pi element14
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
 
Senior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster ComputingSenior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster Computing
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptx
 
Python on FreeBSD
Python on FreeBSDPython on FreeBSD
Python on FreeBSD
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
 
Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi board
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 

Recently uploaded

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 

Recently uploaded (20)

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 

Raspberry Pi for IPRUG

  • 1. Raspberry Pi Frank Carver frankcarver.me raspberryalphaomega.org.uk
  • 2.
  • 3.
  • 4. ARM1176 CPU @700MHz • Broadcom BCM2835 chipset & GPU • 512MB* RAM • USB, Ethernet, 1080p HDMI, audio • 8 GPIO pins + UART, SPI, 12C • Storage on SD/SDHC Card • Linux, RiscOS etc. or “bare metal” • About £25
  • 6. ATmega328 CPU @16MHz • No GPU • 32K Flash, 2K SRAM, 1K EEPROM • USB, no network or video • 14 GPIO pins, 6 analogue inputs • No storage • “Bare metal” cross-compile only • About £18
  • 8. Intel CPU @2.8GHz • Intel HD GPU • 2GB RAM • USB,Ethernet,SATA,HDMI,Wireless,… • No IO pins • 500GB hard drive, DVD • Windows, Linux, etc. • About £300
  • 9.
  • 10. Software Development Bare Metal Linux • Assembler • Pretty much anything • Cross-compiled C/C+ • Python + etc. • Ruby • Hand-built languages • Java • perl • PHP • bash • …
  • 11. So let’s do some Ruby
  • 12. So let’s do some Ruby Step 1: installation
  • 13. So let’s do some Ruby Step 1: installation • sudo apt-get install ruby1.9.3 That wasn’t so hard 
  • 14. Ruby talks to hardware File.open('/sys/class/gpio/export', 'w') { |file| file.write("17") } File.open('/sys/class/gpio/gpio17/direction', 'w') { |file| file.write("out") } File.open('/sys/class/gpio/export', 'w') { |file| file.write("27") } File.open('/sys/class/gpio/gpio27/direction', 'w') { |file| file.write("out") } File.open('/sys/class/gpio/export', 'w') { |file| file.write("22") } File.open('/sys/class/gpio/gpio22/direction', 'w') { |file| file.write("out") } begin while true do for r in 0..1 File.open('/sys/class/gpio/gpio17/value', 'w') { |file| file.write("#{r}") } for g in 0..1 File.open('/sys/class/gpio/gpio27/value', 'w') { |file| file.write("#{g}") } for b in 0..1 File.open('/sys/class/gpio/gpio22/value', 'w') { |file| file.write("#{b}") } sleep 1 end end end end rescue SignalException File.open('/sys/class/gpio/gpio17/value', 'w') { |file| file.write("0") } File.open('/sys/class/gpio/gpio27/value', 'w') { |file| file.write("0") } File.open('/sys/class/gpio/gpio22/value', 'w') { |file| file.write("0") } end
  • 15. A nicer way require "pi_piper" pin_r = PiPiper::Pin.new(:pin => 17, :direction => :out) pin_g = PiPiper::Pin.new(:pin => 27, :direction => :out) pin_b = PiPiper::Pin.new(:pin => 22, :direction => :out) begin while true do for r in 0..1 if r==1 ; pin_r.on else pin_r.off end for g in 0..1 if g==1 ; pin_g.on else pin_g.off end for b in 0..1 if b==1 ; pin_b.on else pin_b.off end sleep 1 end end end end rescue SignalException pin_r.off pin_g.off pin_b.off end
  • 16. Another way require "wiringpi" io = WiringPi::GPIO.new(WPI_MODE_GPIO) begin while true do for r in 0..1 io.write(17,r) for g in 0..1 io.write(27,g) for b in 0..1 io.write(22,b) sleep 1 end end end end rescue SignalException io.write(17,0) io.write(27,0) io.write(22,0) end
  • 17. Input require 'pi_piper' include PiPiper watch :pin => 23 do puts "Pin changed from #{last_value} to #{value}" end #Or after :pin => 23, :goes => :high do puts "Button pressed" end PiPiper.wait
  • 18. So what makes it special?
  • 19.
  • 20.
  • 21. Raspberry Pi is the gateway drug to microelectronics
  • 22.
  • 23. More Fun – Ruby USB • wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb- 1.0.9/libusb-1.0.9.tar.bz2 • tar xjf libusb-1.0.9.tar.bz2 • cd libusb-1.0.9 • ./configure • make • sudo make install • sudo apt-get install libusb-1.0-0-dev • sudo gem install libusb