Axiometa
Button D-Pad
Button D-Pad
SKU:AX22-0016
Regular price
$3.10
Regular price
Sale price
$3.10
Unit price
per
Taxes included.
Shipping calculated at checkout.
Couldn't load pickup availability



-
Pinout
-
Interface
PCB Design
-
Top
-
Bottom
Arduino Example Code
#define PORT 8
int debounce = 150;
void setup() {
Serial.begin(9600);
}
void loop() {
if (analogRead(PORT) > 1000) {
} else if (readAnalogButton() == 4) {
Serial.println("DOWN");
delay(debounce);
} else if (readAnalogButton() == 2) {
Serial.println("RIGHT");
delay(debounce);
} else if (readAnalogButton() == 5) {
Serial.println("LEFT");
delay(debounce);
} else if (readAnalogButton() == 1) {
Serial.println("CENTRE");
delay(debounce);
} else if (readAnalogButton() == 3) {
Serial.println("UP");
delay(debounce);
}
}
int readAnalogButton() {
int buttons = 5;
int resolution = 1023;
float avg = resolution / float(buttons);
int val = analogRead(PORT);
if (val > (buttons - 0.5) * avg) {
return 0;
}
for (int i = 0; i < buttons; i++) {
if (val < round((i + 0.5) * avg)) {
return i + 1;
}
}
return 0;
}
Guides and Blogs
-
First time setup
Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.
-
Automatic Street Lights
Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.
-
How Does an LDR work ?
Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.