DFRobot DFRduino Romeo-All in one Controller V1.1 Manual - Página 5

Procurar online ou descarregar pdf Manual para Controlador DFRobot DFRduino Romeo-All in one Controller V1.1. DFRobot DFRduino Romeo-All in one Controller V1.1 13 páginas.

DFRobot DFRduino Romeo-All in one Controller V1.1 Manual
char start_msg[15] = {
"Start loop "};
int
adc_key_val[5] ={
30, 150, 360, 535, 760 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
/* Print that we made it here */
Serial.println(start_msg);
}
void loop()
{
adc_key_in = analogRead(7);
digitalWrite(13, HIGH);
/* get the key */
key = get_key(adc_key_in);
if (key != oldkey) {
delay(50);
adc_key_in = analogRead(7);
key = get_key(adc_key_in);
if (key != oldkey) {
oldkey = key;
if (key >=0){
Serial.println(adc_key_in, DEC);
Serial.println(msgs[key]);
}
}
//we'll use the debug LED to output a heartbeat
// read the value from the sensor
// convert into key press
// if keypress is detected
// wait for debounce time
// read the value from the sensor
// convert into key press