0% found this document useful (0 votes)
47 views9 pages

Give Python Esfaulpe: To Inpeut Pins Os

Y

Uploaded by

Bharath Aa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views9 pages

Give Python Esfaulpe: To Inpeut Pins Os

Y

Uploaded by

Bharath Aa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

ONIT-O

esfaulpe
fom Raspheaay pins
O Give Python psog3om to seod inpeut TIO MARxS][Dec
2019
o S MIARKSJ
MARKS]
(o
PopSSOm a
RaGphebayPI2 os
olo yeca tuse to
cohal Longcnge oct/Nov-2020)

supposg python bhak


Raspbesay pi
uns Linu pyBhon Ps0g3o
u n any
YotL
Can pUspo32
he box 7hesefove, it 18 he genea
Ou of tes. Howeves
pi
nosmal Compu Pin on Raspbesy
Sons on a GIPTO
psovided by
Hhe Con nfefae
input/outpul Capabilty Intesnet of hings you
odevice fos Pi
Rapbesy
Ehat mares it useful achuatoss
with
senso5 ond inlextoes.
sebial
O wicle vosiey of I2C
and
the sPI,
GPIo pins and
uGing bhe ko Raspbeay
P
Connectec
sensoss
the fos
Trput fzom can be facen,
Vadieus
acúonS
Poocesse ond emat1 foiggexn
Con be seoves, Serding
an
daa to a
inslarce Senodg
O s e b ysauitch

CorfaolGng LED
cuiPh Raspbeny Pi
a n eED
Confoolling
exampe of
oa bosic fuan
kef u s discugs expbuins ho fo
psogaan D
The foleculng the LeD
foom Rocbesoy Pi. ine In this example
Command ofnes
L e D onloBf
foom
Connecf Ehe 1eD to any
Conneciedto GPIO Pin 18.you Con

GPTO Pln as 6e
Rasbesoy Pi Console
EXampleSaitcling LeD onloff fom

$echo 19>/sys/coss/gpio/exposT

pio 18
co /sys/elass/ g pio /g
18 dlecion to oul
#set pin

s echo ouf > dugection


#TusnAED on

$echo > value

TUon LED ofF

echo O> value

D
pyhon poogoam foo blinking LE
uses he RPi GPIO mecloe module to
The pxcgaom
Conhsol Ehe GIPIO
on Raspbeany pi Tn His po0goom ue set
altesrabiely
to outpuk oro then wsite Tsue/False
pin 18 diection
secool
olelay of one
oflex a
Pogpm

GPIo
impoel ppi- GPIOas
impoat ime

GPIO Sefmooe (GprO BCM)


GPIO Selup (is, GPTO.OUT)

olksile TBue
GPIO. OUfpof (18, 7sue
time SleePC)
GPIO-OUtput (18,Folse)

Gime sleeP C)
p) PinS
etlvc Py hon poogoom to seoel tnput aom Rosphe bay
(o8)
culleh wilh Raspbesay Pi. Dcuss indelait
Toe/ocing on LCD ad chh In
Tn Has
ta
l h aa sautch
SHc
i
wHh LED
fos Cootollrg a n ts Conneded
A1 Pylhon pagom &switch
The Connecfed to
GPTO pin 19
Checke
8
he LED ts voalue of pin 2 5
example the
wksle doop poezscol.
the tnfeoie swllcb t e
kopin a5
In
LED
foggleo, if the
stak of
Cno the fomn
1opul
shoue how to get
example some acion
7hs anol take
the input on L E D .
G1PTO pins and of
paocess

toggling ehe stalë


example L6
The ocion in his
0 Sul[dh.
an LeD wih
Contooling
paogoom fox
ExompleP h o n
tmpo sleep
f0m time
as GPIO
Rpi- GiPTo
imfoot
BCM)
GPIO Sefmooe (G PTO

#StwHch pin
TN)
GPTO Sefup (25, GPTO
#LED pin
GPTO- OUTD
G1PTO Setup (18,

StaTe-folse

def togleL ED (pin);


State nat stale
GPTO-OUtput (Pin, state)
while 73ue:

Tsue):
if (GPTo input(25)
-

foggleLED (Pin)

sleeP (-O1)
excepf kepbooedIntesoupt:

exut C)
Pi.
he Componen& of Rasphesoy
Ls and explain Lo7 MARxs]
Toct)Nov-2020)
min-Computes
Raspbesoy Pi
Ls O low Cosi suns
Cool Raspbesty pi
tho
Size of h Czedit almast all
fasics
with he physiCal Linux ano
con pesfosm Pi
Plavoos of tothis, Raspbexay
vazious
con do In adition genexal
fhaough Bie
Compules
noana despop and oc
fuatss
senso88
inte>focing suns i n u z
Opesai sysiem
ailsoaulles Since
Rospbesoy Pi
PUOpogeT0 Pins
Box.
PyBhan 'out of the
i tSoppos on an
ARM
POceg3S
POOCES

pi is based u7n
Rospbey Revision 2)
Comes

OPooCogsO1 PAM:
Raspbezsy pi (Moolel B, SDRAM
veszion of and 5 h MB
The latestf ARM
1763Z-F
Poocessos

L000 poucz3
700MH Cobe (oslex-AT2)
BCM2711,guod
(B00dcom
Lalest Pocpbesay pi +
ond 4-6tB SDRAM (201a)
Comes wih 156H3 The lalest
mooek

comes colHh usB poate


pi Poats)
@UGB Pos Raspbesy
pots) s 20sB (2 0 PO
2 05B (3-o
Rospbesay pi 4 8 having RJA5
sBandasd
a
Comes wilh
6 elheonet paplb paspbeooy pi Ca ble (oo) a
096

ethesnet
Can connect an
Ethebpei poat. You
Conntctivity
to PoOviole 1ptesnet
wi-Fi aoaptes
holh
-pi paovides
HDMI outpet The HDMI poat an Raspbeony-
Raspbesay-p
to d monato
can Connect
oofpeut. you
vigeo oudio
HDMI Cable.
USing a n numbe of genezal
wlh a

6GPIO pins Raspbesay- pi Comes


of
types of
pIOe
p ins
o
Onr

axe fovo types


fovo
pin8 Thexe
tnpuk)output
PUBposo
Pospbesy pi-
OTue GPIO PIn
1 2 c Iotezfae Pins

SPI tntealace pins

sesial Rx
Ond T Pins
DST 1otefoz Can beu
nlesfae (Dsr) he
Dispoy Sesial
to Rasphesry pi
Connect on LCD ponne
b ed
Lo
Intetae Con
Ssid toteofae (csT): h e 8 CST
Comes
module to Raspberay p)
Connecta Camexa
slatus LEDS6
satu5 LEDS Raspbesvy pi hus Ave
sioius LeD Function

SD Casd accegs
ACT
Poesert
poues 8
pwR 33v

LAN, Connec tepd


FDX Foll oluplex

ANK LinK/Nefuosk achvily


2AN
Connecled
/O0 100 Mbit
have a buslt in apexating
a G0 Cad S0 Raspbezoy pi does o
plug-in an sD Coazo loodeo
yo
syste and stooag
to the sD Cosol sat
ih a linux Image

mico0-USB Connectos fox


0 Poucs Tnput Raspbeo3y pi ho8 O
POwe1nput.

LinUX
syslems seppooted by Raspbe3ay pi.
©penatng
DISCs veleus
inUX
suppooB vadious flavoss of
Raspbe0y pi

Ls a Debian whee7y Pot


Raspbjan Lino
0 Rospbian This s the
secommened

2eo fos pospbezay Pi


opimi
fos Raspbesay Pi
Anuz
Poat fos AMD devices.
Aoch Linu
O HEch Aoch ie an

opúmized fos
inux Le a Feclo20 Linu
pidexa pidoxa
Rospbeby pi odistoibünon
meodia-Cenles
Rasp BMC 18 an xBMC
ka6pPBMC
tos Roepbesay Pi
usesfoienol
openELEC openELEC 18a fost and
oistsibuion
media- Contes
XBMC
opeaating
and Compact
18 a vesy fast
RTSC0S PISC Os

System
Di2Cws Rospbesoy pi nfesfaes in detatl
(o P
T2c inteafotog on Raspbesy
the use of GpT
r 1s fo
intebfaces
and I2c
sPI
has Sesiak,
Raspbes8p pi

dlala toansfes bus eeeive (R,


Rospbesay P
intesfaco on pesiphezek
sexial aiHh sezial
CommuniCakion
SesialThe
f a
(T) pins
toonSm/t
and
synchooous
pesiphesal Iofexaco (SPI) 18 C
S P I - Sesial wlth one (oo) o
Communicatng
wed fos
seaial daa pootocol 3 od
Connectio, thepe
spT
In on aB
pesipheal devices device8 These
ane too)
mose pesiphe sal
and
masles olevice
Pi foo sps infBae
Ave pin8 on Raep besay

OMISO (Masfes so slave 0vt)


fo the pesiphesov
mases Bne fos sendig dala

MoST (Masfes out


slave Tn)
the mostex
Slave Bne fo serouing dala o
sCK (sesial clocr)

masfes to synchvonize dala


Clock genesated by
toonsmig880n

CEO (chip ennbe o):


devices
enable (oa) olsable
To

CEO (Chip Croble D


encble (oa) dsable dlevices.
To
Connec
Pins on Raspbeay pi avou you to
The T2c esjaco
T2c intezface alows synchxonous dale tansfes
roxoluoxe madtules
two pinst6DA (dalh-bne)
with just
OSDA (dalo line)
scL Cclock Line)

1OT Ches
than ROSpbey pi ?
devites n
0 what ae clhex
cubieboo
Bone Black ond
pe DLino Beage

OpenELEC on Raspbexay pi
whal v5 media-
UBe&-faiendly xBMC
OpenELEc is a fast ano
Cenles distaibution.

DeAne 2ospbehoy pi hub Thes ts


elinu Oag.Thes
hub s hosted by euinu oag
ROSPbeaay pi hasduose cino
on the Pi's
Omo&ve
wii of infomation

ConHguosadion

what ls Linuxs viatal fle system2


Phe
wosk Ove not actual ples on

The hles thad tue past of


sathes ase a
Raspbesoy pis sD Cad, but zeb moauces

which 1g a system that


Ale system)
n u x l s viatual funcáons of
he boaad

to acces8 low level


if eagies

o Simples woy
ohat ts the use of GpTO pins 2
papoSe Inpu)
aumbes of gevesal
pi Comes wlth P)
Raspbeboy o n Raspbesay
pInS
fous types of
OUp Pin8 Theve a v e
Pi5
O Taue GPTO
1 2 c Intestace pins

SPT infestae pins

Pins.
anol T
Sesia
Ry

feodores of pospbexay Pi
L r s t he Suppoals
Tt
mint- Compfes-
loo-Cogt e
Easpbesay pi 18 ofhCol
The
opezating system
vazious Plavoxs of inux
Rasphean Linu
18
ecommenoleo
opeabng system I2C
inteafaces
anod
Scsial,SPI
209pbesoy pi has
Python
pi Suppools
t s a n s f e s . Raspbesay
fos dala
for

You might also like