lunt i an laboratory 2
TRANSCRIPT
-
8/12/2019 Lunt i an Laboratory 2
1/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
0 Tweet 0
Search
topics
android app
arduino
code
do it yourself
Extra
gadgets
hacking gadgets
just looking
my projects
Software
0Like Share
Arduino Tutorial Series Stay ON
LED Using Millis-Based Debouncing
Posted on January 4, 2013by admin
...
Turning the LED on with a single button push and turning it off
again with another button push. This sketch is based on millis
debouncing and not on simple delay debounce. With this sketch,
continuously pressing the button will not make the led go on and
off. If the led is OFF, pressing and releasing the button
(regardless of time length) will turn it ON. Pressing it again will
turn the led off.
Home Arduino Tutorials About Me
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Stay%20ON%20LED%20Using%20Millis-Based%20Debouncing%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Stay%20ON%20LED%20Using%20Millis-Based%20Debouncing%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttp://www.luntianlaboratory.com/http://www.luntianlaboratory.com/arduino-tutorials/http://www.luntianlaboratory.com/about/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Stay%20ON%20LED%20Using%20Millis-Based%20Debouncing%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttp://www.luntianlaboratory.com/category/android-app/http://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/category/code/http://www.luntianlaboratory.com/category/diy/http://www.luntianlaboratory.com/category/extra/http://www.luntianlaboratory.com/category/gadgets/http://www.luntianlaboratory.com/category/hacking/http://www.luntianlaboratory.com/category/byte/http://www.luntianlaboratory.com/category/projects/http://www.luntianlaboratory.com/category/software/http://www.luntianlaboratory.com/arduino/on-led-millis-debounce/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/arduino-tutorials/http://www.luntianlaboratory.com/about/ -
8/12/2019 Lunt i an Laboratory 2
2/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
recent art ic les
Western Digital My Passport
1TB
Intel RST for Cooler Platform
Controller Hub (PCH)I Installed a Lincensed ESET
NOD32 Antivirus!
The Tale of Impulsive Upgrader |
From Windows.3x to Windows 8
/ 8.1
Bluetooth File Transfer Protocol
Version 2
Blocking The Globe Tattoo
Ghost Web Icon
A Laptop Cooling Pad Test
recent commentstan on Fixing the Slow Arduino
IDE | More Than 20 Seconds
Delay
Aldionon The Huawei Mobile
Pocket Wifi E5220
const byte buttonpin = 2;
int buttonvalue = 0;
int interval = 300;
int onoff = 0;
unsigned long timeone;
const byte ledpin = 13;
void setup(){//void setup begin
pinMode(ledpin,OUTPUT);
pinMode(buttonpin,INPUT);
}//void setup end
void loop(){//void loop begin// read the status of buttonpin
buttonvalue = digitalRead(buttonpin);
// I think this very short delay is
// necessary to stabilize the code
delay(50);
// SET THE timeone VALUE TO
// millis() IF THE buttonvalue ==// TO one
if(buttonvalue == 1){
timeone = millis();
}
// COMPUTES WAIT FOR THE interval VALUE
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/gadgets/western-digital-my-passport/http://www.luntianlaboratory.com/gadgets/intel-rst-cool-pch/http://www.luntianlaboratory.com/software/licensed-eset-nod32/http://www.luntianlaboratory.com/extra/from-windows-95-to-windows-8/http://www.luntianlaboratory.com/android-app/bftp-2-tutorial/http://www.luntianlaboratory.com/extra/globe-tattoo-ghost-icon/http://www.luntianlaboratory.com/gadgets/laptop-cooling-pad/http://www.luntianlaboratory.com/arduino/slow-arduino-ide-fix/#comment-2832http://signal/http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2831 -
8/12/2019 Lunt i an Laboratory 2
3/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Aldionon The Huawei Mobile
Pocket Wifi E5220
admin on Gizduino Mini on
Windows 7 and Windows 8
loreen on Gizduino Mini on
Windows 7 and Windows 8
tags
androidarduinobatterycameracomputerddwrt
electricityepsonfanfreedom
planglobehard diskhard
drivehuaweiinternet
laptoplcdldrledledslinux
mmorpgmotormp3phonepotentiometerpower supplypsu
ush button osroutersamsun
m s - me,
// INCREMENT onoff VALUE BY 1
if((millis()-timeone) == interval){
onoff = onoff + 1;
}
// IF THE VALUE OF onoff
// TURNS 3, THEN RETURN IT
// TO ONE
if(onoff == 3){
onoff = 1;
}
// TURN THE LED ON OR OFF
// DEPENDING VALUE OF
// onoff VARIABLE
if (onoff == 2){
digitalWrite(ledpin,HIGH);
}
if (onoff == 1){
digitalWrite(ledpin,LOW);
}
}// void loop end
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://signal/http://www.luntianlaboratory.com/gadgets/huawei-e5220-pocket-wifi/#comment-2830http://www.luntianlaboratory.com/arduino/gizduino-mini-7-8/#comment-2829http://www.luntianlaboratory.com/arduino/gizduino-mini-7-8/#comment-2827http://www.luntianlaboratory.com/tag/android/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/battery/http://www.luntianlaboratory.com/tag/camera/http://www.luntianlaboratory.com/tag/computer/http://www.luntianlaboratory.com/tag/ddwrt/http://www.luntianlaboratory.com/tag/electricity/http://www.luntianlaboratory.com/tag/epson/http://www.luntianlaboratory.com/tag/fan/http://www.luntianlaboratory.com/tag/freedom-plan/http://www.luntianlaboratory.com/tag/globe/http://www.luntianlaboratory.com/tag/hard-disk/http://www.luntianlaboratory.com/tag/hard-drive/http://www.luntianlaboratory.com/tag/huawei/http://www.luntianlaboratory.com/tag/internet/http://www.luntianlaboratory.com/tag/laptop/http://www.luntianlaboratory.com/tag/lcd/http://www.luntianlaboratory.com/tag/ldr/http://www.luntianlaboratory.com/tag/led/http://www.luntianlaboratory.com/tag/leds/http://www.luntianlaboratory.com/tag/linux/http://www.luntianlaboratory.com/tag/mmorpg/http://www.luntianlaboratory.com/tag/motor/http://www.luntianlaboratory.com/tag/mp3/http://www.luntianlaboratory.com/tag/phone/http://www.luntianlaboratory.com/tag/potentiometer/http://www.luntianlaboratory.com/tag/power-supply/http://www.luntianlaboratory.com/tag/psu/http://www.luntianlaboratory.com/tag/push-button/http://www.luntianlaboratory.com/tag/qos/http://www.luntianlaboratory.com/tag/router/http://www.luntianlaboratory.com/tag/samsung/http://www.luntianlaboratory.com/tag/push-button/http://www.luntianlaboratory.com/tag/qos/http://www.luntianlaboratory.com/tag/router/http://www.luntianlaboratory.com/tag/samsung/ -
8/12/2019 Lunt i an Laboratory 2
4/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
sd cardseven segmentssmartsony
stepper motorsun cellular
tattootoshibausbwifi
windowswirewordpress
RELATED POSTS
1. Arduino Tutorial Series The Millis-Based Delay
2. A Simpler Arduino Debouncing Example
3. Arduino Tutorial Series The On-board Blinking LED
4. Arduino Tutorial Series A Push Button and A GlowingLED
...
0 Tweet 0
This entry was posted in arduinoand tagged arduino, debouncing, millisby
admin. Bookmark the permalink.
0Like Share
http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/tag/push-button/http://www.luntianlaboratory.com/tag/qos/http://www.luntianlaboratory.com/tag/router/http://www.luntianlaboratory.com/tag/samsung/http://www.luntianlaboratory.com/tag/sd-card/http://www.luntianlaboratory.com/tag/seven-segments/http://www.luntianlaboratory.com/tag/smart/http://www.luntianlaboratory.com/tag/sony/http://www.luntianlaboratory.com/tag/stepper-motor/http://www.luntianlaboratory.com/tag/sun-cellular/http://www.luntianlaboratory.com/tag/tattoo/http://www.luntianlaboratory.com/tag/toshiba/http://www.luntianlaboratory.com/tag/usb/http://www.luntianlaboratory.com/tag/wifi/http://www.luntianlaboratory.com/tag/windows/http://www.luntianlaboratory.com/tag/wire/http://www.luntianlaboratory.com/tag/wordpress/https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2F&text=Arduino%20Tutorial%20Series%20%E2%80%93%20Stay%20ON%20LED%20Using%20Millis-Based%20Debouncing%20%7C%20Luntian%20Laboratory&tw_p=tweetbutton&url=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttp://twitter.com/search?q=http%3A%2F%2Fwww.luntianlaboratory.com%2Farduino%2Fon-led-millis-debounce%2Fhttp://www.luntianlaboratory.com/arduino/on-led-millis-debounce/attachment/gizduino-version-3-with-button-circuit/http://www.luntianlaboratory.com/arduino/millis-delay-base/http://www.luntianlaboratory.com/code/simpler-debounce/http://www.luntianlaboratory.com/arduino/on-board-blinking-led/http://www.luntianlaboratory.com/extra/push-button-glowing-led/http://www.luntianlaboratory.com/category/arduino/http://www.luntianlaboratory.com/tag/arduino/http://www.luntianlaboratory.com/tag/debouncing/http://www.luntianlaboratory.com/tag/millis/http://www.luntianlaboratory.com/author/admin/http://www.luntianlaboratory.com/arduino/on-led-millis-debounce/ -
8/12/2019 Lunt i an Laboratory 2
5/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Leave a Reply
Your email address will not be published. Required fields are
marked *
Name *
Email *
Website
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf -
8/12/2019 Lunt i an Laboratory 2
6/6
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Arduino Tutorial Series The Millis-Based Delay
Tinkering With Old Epson TX10 Power Supply
by luntianlaboratory.com 2010-2012see change log, site rules & stuff
posts with pictures of luntiancorner.com were moved articles. they are owned by the same author
Post Comment
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.luntianlaboratory.com%2farduino%2fon-led-millis-debounce%2f&id=ma-140324194926-43b458edhttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.luntianlaboratory.com/arduino/millis-delay-base/http://www.luntianlaboratory.com/hacking/tx10-power-supply/http://www.luntianlaboratory.com/http://www.luntianlaboratory.com/about/http://www.luntianlaboratory.com/about/