









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
its for cmp3006 and 3010 some of the university notes it will be help
Typology: Lecture notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!
Switches as Digital Input
Connecting Switches to a Digital
System
𝜇𝐶
Connecting Switches to a Digital
System
Pullup &Pulldown
𝜇𝐶
𝜇𝐶
I/O Ports
DDRxi PORTxi Function
Input - Floating
0 1 Input – internal Pullup connected
1 0 Output LOW
1 1 Output HIGH
Counting Event with Buttons
(Switch)
loop() {
b = digitalRead(0);
if(b == 1){
// PRESSED
digitalWrite(13,HIGH);
}
else{
digitalWrite(13,LOW);
}
}
count = 0;
loop() {
b = digitalRead(0);
if(b == 1){
count++;
}
}
count = 0;
presses = false;
loop() {
b = digitalRead(0);
if(b == 1 && !pressed){
count++;
pressed = true;
}
else
pressed = false;
}
Bouncing
Debouncing
INTEGRATED CIRCUIT
SOLUTIONS
Bouncing
int state =0;
loop() {
b = !digitalRead(0);
state= (state<<1) | b | 0xe000;
if(State==0xf000){
// PRESSED
}
}
0111111111111