Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include "DigiKeyboard.h"
Adafruit_ADS1115 ads;
void setup(void)
{
Serial.begin(9600);
ads.begin();
DigiKeyboard.sendKeyStroke(0);
}
void loop(void)
{
for(int pin = 0; pin < 4; pin++) {
int inputValue = ads.readADC_SingleEnded(pin);
if(inputValue > 2048) {
switch(pin) {
case 0 :
/**
* [x][ ]
* [ ][ ]
*
* Button 1 code here
*/
break;
case 1 :
/**
* [ ][ ]
* [x][ ]
*
* Button 2 code here
*/
break;
case 2 :
/**
* [ ][x]
* [ ][ ]
*
* Button 3 code here
*/
break;
case 3 :
/**
* [ ][ ]
* [ ][x]
*
* Button 4 code here
*/
break;
}
DigiKeyboard.delay(100);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.