IYXH

Life is fantastic

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

Rédigé par Alain Sanguinetti 9 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.

9 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?

Répondre
#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
read?

Répondre
#3  - dewamovie a dit :

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

Répondre
#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!

Répondre
#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!

Répondre
#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.

Répondre
#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..

Répondre
#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!

Répondre
#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
much.

Répondre

Écrire un commentaire

Quelle est la deuxième lettre du mot cmalex ?

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