Monday, October 23, 2017

Arduino Motorcycle Safety Device

Arduino Motorcycle Safety Device

Project #1 - Monitor Freezing Temperature



As winter approaching, keeping track of ambient temperature to aware of possible ice formation becomes one of the road survival must-do for motorcyclists.

With a very simple program, I am making use of the temperature sensor build in the Lightblue Bean to monitor ambient temperature.

The program is super simple (showing below), it turns on the the Bean's red LED once it detects temperature at/below 3C. 















/*
 * Temperature monitor for freeze warning when ambient temperature drops to/below 3C
 * Single Green LED on when temperature is above 3C
 * Single Red LED on when current temperature is at/below 3C
 */

#define FREEZING_TEMP 3

void setup() {
  // Light Green LED on startup
  Bean.setLed(0,255,0);
}

void loop() {
  int temp = Bean.getTemperature();
  if(temp <= FREEZING_TEMP){
    Bean.setLed(255,0,0);
  } else {
    Bean.setLed(0,255,0);
  };
  Bean.sleep(60000);    // Sleep for 60 seconds
}


No comments:

Post a Comment