I'm getting undefined reference to `setup'
But I don't see why using 1.0.2 ide
const int keyMin = 0; // Keymin, discovered through experiment
const int keyMax = 600; // keymax, discovered through experiment
void loop() {
// read the sensor:
int key = analogRead(A0);
// map the sensor range to a range of four options:
int keyValue = map(key, keyMin, keyMax, 0, 3);
// do something different depending on the
// range value:
switch (keyValue) {
case 0: // your hand is on the sensor
Serial.println("button1");
break;
case 1: // your hand is close to the sensor
Serial.println("button2");
break;
case 2: // your hand is a few inches from the sensor
Serial.println("button3");
break;
case 3: // your hand is nowhere near the sensor
Serial.println("button4t");
break;
}
delay(1); // delay in between reads for stability
}