Life is fantastic

Reading an H21A optical interruptor switch using an Arduino UNO - The simple way that really works

Rédigé par Alain Sanguinetti 18 commentaires

About the Arduino and the H21A optical interruptor switch

Arduino is an open electronics development platform. It is widely used to power electronics projects. There are several boards that feature different capabilities. In my case, I am using an Arduino R3.

The H21A optical interruptor switch is a common piece of hardware. It is composed of an IR led and a photoresistor.

My goal is to use an Arduino to detect when the light is interrupted. As I am a newcomer to electronics and arduino, I started by looking on the internet for information on how to connect the two.

Some examples found on the internet

I found this search result to be relevant : http://www.electroschematics.com/10494/arduino-optical-position-rotary-encoder/

However, it did not worked, maybe because I did not had the recommended resistors at hand.

My solution

The solution that I found to be working is to simply connect the output pin of the H21A to a digital input pin of the Arduino. The trick is to declare the pin as "INPUT_PULLUP", this removes the need for a pull-up resistor ! :-)

Hope this helps !

Rendez-vous sur la page "à propos" pour plus d'informations à mon sujet.

18 commentaires

#1  - nonton movie a dit :

Hey there! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing months of hard work due to no data backup.
Do you have any solutions to stop hackers?

#2  - nonton film online a dit :

Write more, thats all I have to say. Literally, it seems as
though you relied on the video to make your point.
You definitely know what youre talking about,
why throw away your intelligence on just posting
videos to your site when you could be giving us something informative to

#3  - dewamovie a dit :

Fabulous, what a weblog it is! This blog provides valuable
information to us, keep it up.

#4  - http://sextoyu.com a dit :

Hi are using Wordpress for your site platform? I'm new to the blog world but I'm trying to get started and set up my own. Do you require
any html coding knowledge to make your own blog? Any help
would be really appreciated!

#5  - https://dogstee.com/ a dit :

I like the helpful info you provide in your articles.

I'll bookmark your blog and check again here regularly.
I'm quite certain I will learn many new stuff right here!
Best of luck for the next!

#6  - http://gsaranker.net a dit :

Hello, Neat post. There is an issue with your web site in web explorer, may check this?
IE still is the marketplace chief and a large component to folks will pass over your excellent writing because of this problem.

#7  - https://moviesshirt.com a dit :

I am really impressed together with your writing abilities and also with the format for your weblog.

Is this a paid topic or did you customize it yourself? Either way
stay up the excellent quality writing, it is uncommon to look a great
weblog like this one today..

#8  - free adult porn sites a dit :

Thanks for your personal marvelous posting! I genuinely enjoyed reading it, you are a great author.I will make certain to bookmark your blog and will often come back in the foreseeable
future. I want to encourage you to definitely continue
your great posts, have a nice morning!

#9  - True White System a dit :

We would like to thank you again for the lovely ideas you offered Janet when preparing a post-graduate research in addition to,
most importantly, pertaining to providing many of the ideas in one blog post.
Provided that we had known of your web-site a year ago, we'd have
been saved the pointless measures we were choosing. Thank you very

#10  - old asian porn a dit :

It is appropriate time to make a few plans for
the longer term and it's time to be happy. I have read this post and if I could I wish to suggest you some fascinating issues or suggestions.
Maybe you can write subsequent articles referring to this article.
I want to read more issues about it!

#11  - xxx black homemade a dit :

Hi there, I found your blog via Google while looking for a comparable subject, your
web site came up, it seems great. I've bookmarked it in my google bookmarks.

Hello there, simply became aware of your
blog through Google, and found that it is really informative.
I am going to watch out for brussels. I'll appreciate for those
who proceed this in future. Lots of people shall be benefited out
of your writing. Cheers!

#12  - free dtreaming porn a dit :

Its such as you learn my mind! You seem to know
so much about this, like you wrote the guide in it or something.
I feel that you could do with a few percent to force the message home a
bit, however other than that, this is fantastic blog. A fantastic read.
I'll definitely be back.

#13  - female webcam a dit :

Hi, i read your blog from time to time and i own a similar one
and i was just wondering if you get a lot of spam remarks?
If so how do you stop it, any plugin or anything you can recommend?
I get so much lately it's driving me insane so any support is very much appreciated.

#14  - bandarq a dit :

At this time I am going to do my breakfast, once having my breakfast coming yet again to read other news.

#15  - internet casino Gambling Online a dit :

Spot on with this writе-up, I trulʏ beslieve that this site needeѕ a great deal more attention. I'llprobabⅼy
be returning to raԁ through more, thanks for the information!

#16  - Seri Mandarin Subtitle Indonesia a dit :

Hi, this weekend is fastidious for me, for the reason that this moment i am reading this impressive informative paragraph
here at my home.

#17  - video marketing strategy a dit :

The Beef and Vegetable Stir Fry recipe is among the best
healthy recipes for weight loss at home. Would it mean gaining or losing weight and after that being more active, physically or socially.

Each day, set goals for your forms of foods you'll follow and then any exercise you may incorporate to your routine.

#18  - Situs poker online a dit :

I read this post fully on the topic of the difference of hottest and preceding technologies, it's awesome article.


Écrire un commentaire

Quelle est la dernière lettre du mot xapj ?

Fil RSS des commentaires de cet article

© 2017 - Alain Sanguinetti

Site édité par Société Sanguinetti d’Informatique et d’Innovation - EIRL
241 rue de Charenton, Esc. B Appt 3D, 75012 PARIS
SIRET: 800 319 279 00025
Courriel: services@sanguinetti.eu
Tél: +33 7 70 03 56 46
Responsable de la publication : M. Sanguinetti
TVA non applicable, article 293 B du CGI

Site hébergé par OVH
2 rue Kellermann 59100 Roubaix
Tél. : +33 9 72 10 10 07