Today I started to implement something on the RPi. Nothing serious, but I wanted to test the GPIO. First of all I had to install some Python dependencies to read data from it
$sudo apt-get update $sudo apt-get install python-dev $sudo apt-get install python-rpi.gpio
After this, I had to learn a little bit about the GPIO. The General Purpose Input/Output is an interface available on some devices capable of getting inputs and sending outputs. In the RPi, this is the male pins situated on top of the RPi logo in the latest devices.
The following schematics shows which pin corresponds to which usage
Components
- 1 Raspberry Pi
- 1 Ribbon
- 1 Breadboard
- Some wires
- 1 10k Ohm resistor
- 1 Button sensor
How to build
Place the button on the breadboard. On the row of one pin of the button, I had to connect one head of the resistor. The other head had to be connected on another row. On the same row of this head, then, I had to connect the 3v3 pin (pin 1) of the RPi. To do that I had to use the ribbon and then use a wire from the other end of the ribbon.
I have chosen to use the pin called GPIO17 on the image shown. From that pin I connected a wire which was placed on the same row in which one head of the button and one of the resistor were placed. Finally, the ground pin was connected to the other end of the button.
Code
The code was a simple piece of Python that gathered the input from the pin number 17. Here is it:
import RPi.GPIO as gpio gpio.setmode(gpio.BCM) pin = 17; gpio.setup(pin, gpio.IN) while True: input = gpio.input(pin) if input == False: print('button press'); while input == False: input = gpio.input(pin);
Be careful and respect indentation as Python will complain otherwise. I have chosen pin 17 but any GPIO pin will work as long as you change it in your code. The code is extremely simple: with a while True it checks if the button has been pressed. If that is the case, then, it will print the message. While the button is pressed it will just fall into the second while statement.
To run the code, just do this
sudo python filename.py
And that's it. Here is a picture of what I built.
As you can see, the blue wire is the 3v3 pin, the yellow one is the GPIO17 while the black one is ground.
I hope to build some cooler stuff and show it here.
recommended
ReplyDeleteThis post is not going to be on JavaScript but it will be a bit more centered on the Raspberry Pi .As pointed out in an old blog post. As data sink, it would be very nice to have a Raspberry Pi which gathers data from the environment.
ReplyDelete2016 fake rolex watches large pilot version of the replica watches "Little Prince" limited edition IW500916 In 2002, the country from the antique "B-UHR" replica watches to draw inspiration, launched a large size of the large pilot wrist watch IW5002. At that time the basic watch are still 36-40 mm size, 46 mm shape quite shocking
ReplyDeletetablets for kids
ReplyDelete
ReplyDeleteBirds
ReplyDeleteBirds
ReplyDeleteFacebook Auto commenter
ReplyDeleteFacebook Auto commenter
ReplyDeleteMacomb tens unit
ReplyDeleteMacomb tens unit
ReplyDeleteanbefalt tannlege
This particular post is really very interesting. It has a really great peace of Data,
ReplyDeleteI enjoyed very well with this particular blog it has very useful information
I like to much the style of this Article
thats really nice and informative article.Thank You.
hey,look, i found something very interesting article
about garden tools and tips,
best gas grill under 200
best gas grill under 500
best lawn edger
best chaninsaw under 200
best inflatable water slides
Deepest inflatable pool
ReplyDeleteSnow removal
Are you looking for guest posting/blogging sites? then click :
ReplyDeleteguest posting sites in india
Are you looking for guest posting/blogging sites? then click :
ReplyDeleteguest posting sites in india
Very meaningful & well defined blog. willing to see more like this.
ReplyDeleteBULK SMS
ReplyDeleteDigital marketing
Connect with The Most Trusted BULKSMS Provider in India. Attractive Price with Guarantee 100% Delivery. Call :9907922122
Bulk SMS service simply means sending out a large number of SMS for delivery to targeted mobile numbers.
Have any issue related to AOL, AT&T ??
ReplyDeleteAOL Missing Emails Problem? Aol Mail Disappeared
How I Fix Can’t Sign Into Sbcglobal Email Problem
At&t Email Not Working On My Devices | At&t net email problem?
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteOur bureau is the only area known to provide friendly and esthetical girlfriend (escort service in jaipur) and companion which you can't deny in dreamy state. It is because of the services of the sexy babes are extremely warmth, esthetical and perfect in each and every sense. The instant can always be memorable and lingering. It may be so good a grin will flash on mind memory the experience. They are largely of college going pupils of hi society WHO enjoys to serve them beforehand of fellows.
ReplyDeletecall girls in jaipur
Our bureau is the only area known to provide friendly and esthetical girlfriend (escort service in jaipur) and companion which you can't deny in dreamy state. It is because of the services of the sexy babes are extremely warmth, esthetical and perfect in each and every sense. The instant can always be memorable and lingering. It may be so good a grin will flash on mind memory the experience. They are largely of college going pupils of hi society WHO enjoys to serve them beforehand of fellows.
ReplyDeletecall girls in jaipur
The Government of India launched the Skill India campaign on 15th of July, 2015. This program comes under the direction of Ministry of Skill Development and Entrepreneurship. Skill India plan was introduced by the government to promote the skill development of the youth of the Indian economy especially the ones coming from the rural sector. This program is working on the certification and employment of the youth of India. The purpose is the creation of skill in youth to strengthen the infrastructure in order to support entrepreneurship development and skill development in the economy through Apprenticeship training programmes.
ReplyDeleteelectrical apprenticeship vacancies
Peptid
ReplyDeleteThis is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post.
Hazır otel sitesi
ReplyDeleteHazır otel sitesi paketleri
Profesyonel otel sitesi
Used Test Equipment
ReplyDeleteI am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
Amazing knowledge and I like to share this kind of information with my friends and hope they like it they why I do...! webstagram
ReplyDeleteOur expert technicians suggest about the maximum possible solutions for account live password reset. Our toll free account.live.com/password/reset number 1-800-436-6070 is open and in working mode 24X7.
ReplyDelete>Our outlooks-live expert technicians suggest about the maximum possible solutions for your issues. customer support toll free account.live.com/password/reset number 1-800-436-6070 is open and in working mode 24X7 or visit our website.
ReplyDeleteTo activate Norton visit norton.com/activate and verify product key or Get Technical support for norton.com/setup download, install and online activation. If you do not have Norton subscription do not worry call customer support 1-800-436-6070 toll free.
ReplyDeleteDuring any of these processes, if you face any trouble then contact our mcafee installation toll-free number 1-800-436-6070 USA or Canada for an instant support by a certified technician. We provide support for all mcafee.com/activate errors including help more visit our website.
ReplyDeletepisi pisicik
ReplyDeletepara kazan
oyun oyna
kedi oyunu
oyna para kazan
para kazandıran oyunlar
your Microsoft account is locked out, you won’t be able to access your computer or Laptop. So how do you get account live password reset this the answer is actually quite simple. Instead of account.live.com.sign in with the online Microsoft account.live.com/password/reset call 1-800-436-6070 toll free.
ReplyDeleteIf your apple id locked you want to change your forgot apple id password to another third-party email address, you need to verify your account after you enter the email address that you want to use as your apple id reset more detail please visit our website or online chat.
ReplyDeleteYour apple id password reset is the key to all Apple services. You use it on your iOS device and your Mac. You log in with it to iCloud the apple id password reset Store, and more if you forgot apple id password visit our website help our expert online.
ReplyDeletethis article is actually flawless!!
ReplyDeleteFashion Fabrics provide a wide range of quality fabric. Lace fabric, Prints, laces, net embroidery, khadi, denim and more.
Buy Indian Fabric By The Yard, Indian Fabric Store Online
Fabric Store, fabric, laces fabric, faric lace, print fabric, printed fabric , laces in india, lace fabric in india, fabric store in india, online fabric in india, fashion fabrics online fabric, laces, Printed, Solids, Textured, Handloom, Cotton, Rayon, Crepe, Woolen, Velvet, Gold Block, Embroidery, rayon fabric, georgette fabric, polyester fabric, cotton fabric, fabric online, linen fabric, fabric design, silk fabric, lycra fabric, jacquard fabric, velvet fabric, ikat fabric, nylon fabric, knit fabric, knit fabric, chiffon fabric, woven fabric, upholstery fabric, online fabric store, textile shop near me, fabric stores, wool fabric, fabric material
ReplyDeleteI love this content keep sharing !!!
Fashion Fabrics provide a wide range of quality fabric. Lace fabric, Prints, laces, net embroidery, khadi, denim and more.
Buy Indian Fabric By The Yard, Indian Fabric Store Online
denim fabric,denim fabric online india,denim fabric manufacturer in india,denim fabric suppliers,denim material
ReplyDeleteI love this content keep sharing !!!
Fashion Fabrics provide a wide range of quality fabric. Lace fabric, Prints, laces, net embroidery, khadi, denim and more.
Buy Indian Fabric By The Yard, Indian Fabric Store Online
fancy lace
fancy lace for dupatta
fancy lace manufacturers
fancy laces online
fancy lace fabric
This article is very helpful. If you want to know how to open NGO or any type of business registration you are the right place. NGOguru an initiative of TCSL managed by a team of professionals (CA, CS, Advocate, MBAs, and Technocrats) up with progressing and forthcoming Govt. Grants, Projects and Foreign Contributions. NGO guru also provides NGO Registration, Business Registration, 12a & 80g registration, NGO compliance, FCRA Registration and all types of business consultant. For more info call us: +91-9315400876, or visit here: NGOguru
ReplyDeletei really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteWoven gold deals in bathtub, shower, steam, sauna and glass enclosure in India
bathtub company, bathtub company in india, bathtub manufacturer in india, Jacuzzi campany in india, Jacuzzi manufacturer in india, Steam cabin for home in india, Steam cabin for commercial use in india, Sauna for home in india, Steam Generator for home in india, Shower company in india, Shower manufacturer in india, Rain Shower company in india, Rain Shower manufacturer in india, Multiflow Shower company in india, Multiflow Shower manufacturer in india, Multiflow Shower company, Shower panel company in india, Shower panel manufacturer in india, Steam Generator for commercial use in india, sauna for commercial use in india, sauna for spa in india
i really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteWhirlpool Bathtub | Complete Bath Solution | Woven Gold
Jacuzzi Bathtubs, Whirlpool Massage, Freestanding Bathtubs, Bathtub Price, Whirlpool Tub Price, Whirlpool Bathtub, Whirlpool Bathtub Price, Luxury Bathtubs Manufactures, Jacuzzi Massage, Rectangular Bathtubs, Jacuzzi Bath, Bathtub Suppliers, bathtub manufacturers, jacuzzi bath, bathtub price, whirlpool bath, bathtub manufacturers, rectangular bathtub
i really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteHot Tub, Swim Spa, Sauna Manufacturer & Dealer | Woven Gold
hot tub, spa tub, jacuzzi tub, swimming tub, hot spa, jacuzzi spa, spa prices, jacuzzi spa near me, hot bath tub, portable hot tub big hot tubs, jacuzzi hot tubs, outdoor jacuzzi, hot tubs for sale, outdoor hot tub, hot tub spa, small hot tubs, hot spa, hot tub, jacuzzi spa, jacuzzi spa near me, jacuzzi tub, hot bath tub
i really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteSteam Generator & Steam Cabin | Steam Solution | Woven Gold
steam bath, steam generator, steam bath at home, steam room, steam bathroom, steam shower, steam generator price, steam bath generator, steam room shower, steam bath equipment steam generator for steam bath, steam generator for home, bathroom steam generator, steam generator for spa, steam shower bath, sauna steam generator, steam bath unit, steam bath machine, body steamer, Steam for hotels, Steam machine, steam generator, steam bath, steam generator price, steam bath at home, steam room
i really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteMultifunctional Rain Shower | Square & Overhead Showers
Multifunctional Rain Shower, rain shower, overhead shower, light rain showers, rain shower price, waterfall shower, rain shower bathroom, shower systems rainfall shower, rain shower system,overhead rain shower, rainwater shower, multifunction rain shower, square shower, rain shower, rain shower price, overhead shower, waterfall shower
i really impress your work. Thanks a ton for sharing this information in this article.
ReplyDeleteOpenable Shower Enclosures | Frameless | SemiFramed | Framed
shower cubicles, shower baths, shower enclosures, bathroom glass door, shower cabin, shower doors, shower glass, shower cubicle price, shower room, shower baths, bathroom glass door, shower enclosures, shower cubicles, bathroom shower price
Wow nice blog, awesome posting thank you for sharing!
ReplyDeleteEn Son Teknoloji Haberleri
En Güncel Teknoloji Haberleri
Güncel Teknoloji Haberleri
Very Nice article ! great job. Thanks for sharing.
ReplyDeleteSend SMS with India's most trusted Bulk SMS Service Provider in India.
Attractive Price with Guarantee 100% Delivery. Call: +(91) 830 578 1001
I am Alina Stevens from New York. I am a professional writer, nowadays I am writing blogs for troubleshooting technical glitches.
ReplyDeleteatt email not working on iphone
att.net email not working 2019
Looking for Ms office setup help guides, overview which includes (word, excel, power point presentation, OneNote) and facing any technical error due to download, install update and activate on windows or mac can contact to our office setup expert engineer can resolve your all problems.
ReplyDeleteoffice.com/setup
www.office.com/setup
officemyoffice
office setup
office setup product key
Nice content! thanks for sharing with us.
ReplyDeleteAre you looking for reset Mac-book, iPhone, iPad, iPod facing any technical error can contact our computer tech expert engineer can resolve your all problems can also call- in the US, Canada
How to reset iphone X?, reset iPhone 6, reset iPhone 8
Reset Apple ID Password - Can go through the link reset apple id password and follow the instructional steps to reset.
ReplyDeleteVery Nice article ! great job. Thanks for sharing.
ReplyDeleteIncrease your business, Promote your post, video, blog to know more click here!
If you are looking Buy Business leather wallet case that has the particular item you are looking smart wallet quality keeps your bills & cards safe outside for easy access.
ReplyDeleteWhen you Buy Disposable Gloves Online you have to start by searching for a product like Buy Sport Water Bottles Online, Buy sunglasses for men, Buy Joggers for women online or Buy Agility Quick Ladder Online many product can be done by visiting our website that has the particular item you need.
This is our most well known Buy 4pcs Black WWJD Bracelet grouping of arm bands. We've picked the 13 most well known colors we offer You will get two of each shading and as a little something extra, you'll additionally offer you know more detail our website.
We are located in Manchester, England, UK. Clients all over Europe can safely Buy marijuana online UK, from us as we have the best quality Weed for sale.
ReplyDeleteOur Products:
buy cannabis online UK
Order weed online uk
Buy weed online
Cannabis oil sale
Find the Best place to buy pet products online product services in USA. If you are interested in purchased pet product Buy dog accessories online, Pet essentials online store, Buy pet essentials online, Buy cheap pet products online, Buy pet accessories online, and Order pet products online and offer products for visit own website or through an Pet products online store site.
ReplyDelete#Buy pet products online #Buy USB Portable Paw Washing Cup #Buy Pet Hand Bag Online
#Buy Portable Foldable Pet Playpen #Buy Dog Luminous Collar USB Charging
#Buy Pet Water Fountain
Buy Electric Shock Collar
#Buy Pet Cleaning And Grooming Set #Buy Pet Feeder Fountain online
Buy Pet Hair Shaver online
Nice content thanks for sharing with us. Are you looking for Aol sig in visit the official web www.aol.com/mail
ReplyDeleteand enter your login credential having any technical error can connect our highly experienced engineer can resolve your all kind of query at a time.
Wondermouse Technologies is leading Mobile App Widget Development company in india having a pool of developers who are highly skilled in mobile app development and we provide dedicated application maintenance and support right under your budget. Our react native development services are aimed at fulfilling your all requirements.
ReplyDeleteNice Post thanks for sharing if you can provide some computer mcqs that will be great and so nice of you....
ReplyDeleteFind the best product home workout equipment online immediately click our link One Click Smart online shopping company best quality product such as Buy Indoor Cycling Exercise Bike, Buy abdominal exercise equipment online, Buy abdominal exercise equipment online, Buy workout equipment for home if you know more info visit at site.
ReplyDeleteFitness Equipment Folding Treadmill
Buy Indoor Cycling Exercise Bike
Two way Belt Exercise Spinning Bike
Stainless Indoor Horizontal Bars
Buy Male Spring Chest Developer
Buy Push Ups Rack Board
Your articles always have been very informative to me. They are very cognitive and prudently explained . I urge you to update us always without fail.
ReplyDeleteSatta King Result
Delhi Satta
I’m really enjoying the design and layout of your website.
ReplyDeleteTravel in London
Non-Powdered Disposable Gloves: Latex, Nitrile and Vinyl rubber disposable gloves are available in powdered and non powdered varieties.
ReplyDeleteMywifiext is a way to setup Netgear Wi-Fi Range Extender as it will help you to connect the Netgear Extender to your home router; once you are on Mywifi-ext.com all you need to do is click on NEW EXTENDER SETUP that will redirect you to on- Screen instructions or genie setup wizard of Netgear. Check out:
ReplyDeletemywifiext |www.mywifiext-net | Netgear Router Login | Netgear Router Setup | mywifiext | Netgear Nighthawk app
You can choose among them as per your network requirements like if you have large home network then you can go for Linksys RE6500 range extender and if you have smaller network then you go with Linksys RE6300 setup. Linksys re6500 | Linksys re6300 | Linksys extender setup | Linksys re6300 extender setup | Linksys extender setup | Linksys smart wifi login
ReplyDeletewebroot.com/safe
ReplyDeletewww.webroot.com/safe
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
123.hp.com/setup
www.amazon.com/mytv
www.amazon.com/mytv
apple.com/recover
iforgot.apple.com
iforgot.apple.com
yahoo mail signin
yahoo mail login
yahoo mail login
yahoo mail signin
yahoo support phone number
yahoo support number
yahoo mail support number
yahoo mail support phone number
www.youtube.com/activate
youtube.com/activate
www.youtube.com/activate
youtube.com/activate
youtube.com/activate
www.youtube.com/activate
cash app login
cash app sign in
disneyplus.com/begin
bravo.tv/link
samsung.com/printersetup
ReplyDeletecanon.com/ijsetup
canon.com/ijsetup
amazon.com/mytv
hulu.com/activate
hulu.com/activate
www.hulu.com/activate
hulu.com/activate
aol desktop gold download
aa.com/flightchange
roku.com/link
xfinity.com/authorize
webroot.com/safe
webroot.com/safe
www.webroot.com/safe
paypal login
123.hp.com/setup
www.eset.com/activate
eset.com/us/download
paypal login
paypal login
paypal login
www.avg.com/retail
garmin.com/express
garmin.com/express
amazon.com/mytv enter code
www.youtube.com/activate
123.hp.com/setup
amazon.co.uk/mytv
primevideo.com/mytv
appstore.com/redeem
appstore.com/redeem
avg.com/retail
avg.com/retail
www.avg.com/retail
central.bitdefender.com
emails Not receiving has become a common issue and wishes the intense attention of the specialists. However, a number of its users ar whiney concerning their account of gmail not receiving emails creating them wait till they get annoyed.
ReplyDeleteDear author, Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you guest posting sites in India.
ReplyDelete