Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Arduino By Example

You're reading from   Arduino By Example Design and build fantastic projects and devices using the Arduino platform

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785289088
Length 242 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Adith Jagdish Boloor Adith Jagdish Boloor
Author Profile Icon Adith Jagdish Boloor
Adith Jagdish Boloor
Adith J Boloor Adith J Boloor
Author Profile Icon Adith J Boloor
Adith J Boloor
Arrow right icon
View More author details
Toc

Communicating through a terminal


There is one more dilemma that we have to solve in order to have complete control over the electronic appliance. If we create a digital ON and OFF switch that when set to ON sends a turn ON signal to the relay, the problem is that if the physical switch is already ON, the ON signal of the digital switch will end up actually turning OFF the appliance.

"If the appliance is already ON, why would I send a turn ON signal?" Okay, think about this. Both the switch and the relay are ON, but the bulb would actually be off if you look at the two-way switch and the relay image previously shown. Now, if you want to turn ON the bulb through the relay, you actually have to send an OFF signal.

Pretty confusing, isn't it? To solve this, we will use a flag or a status variable that stores the current state of the relay. This will help us solve logical issues such as the one stated before.

Make sure your router is working as expected. Then, plug in the Arduino into the USB port...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime