 	} else if (status == MotionSensor::Idle) {
 		Serial.println(F("Sensor is in idle state."));
 		Serial.flush();
-		ledController.setState(LEDController::Green, LEDController::FlashVerySlow);
+		// If an alarm was played, let the LED flash red.
+		if (alarmPlayed) {
+			ledController.setState(LEDController::Red, LEDController::FlashVerySlow);
+		} else { 
+			ledController.setState(LEDController::Green, LEDController::FlashVerySlow);
+		}
 		logicState = IdleState; // Ready to observe.
 	} else if (status == MotionSensor::Alarm) {
 		Serial.println(F("Sensor alarm."));

		// If the board goes into alarm state, play the sound.
		// This will block the loop, until the sound finishes.
		if (logicState == AlarmState) {
			if (!audioPlayer.play("voice.snd")) {
				Serial.println(F("Error on play."));
				Serial.flush();
				return;
			}
			// Go back into idle state after the sound.
			// The sensor might stay in alarm state for a while.
			logicState = IdleState;
		}
	}
}


void onMotion(const unsigned long currentTime, MotionSensor::Status status)
{
	if (status == MotionSensor::WaitStablilize) {

MotionSensor motionSensor;


/// A list of voice sample file names
const char* const voiceSampleList[] = {
	"v0.snd",
	"v1.snd",
	"v2.snd",
	"v3.snd",
	"v4.snd",
	"v5.snd" };

/// The number of voice samples
const int voiceSampleCount = 6;

/// The next voice sample to play.
/// They play in a loop.
int nextVoiceSampleIndex = 0;

/// Flag if we had an alarm.
/// The LED will flash red, after an alarm was played.
bool alarmPlayed = false;


/// Arduino setup method.
///
void setup() {
	// Set the initial state.
	logicState = WaitForSensor;
