Step 9Load Software to Lilypad
Using Arduino software write the program so the Maxbotix will drive the vibe board.
I used the following program:
//Bats Have Feelings Too
//Wearable computer system to assist the visually handicapped
//Lynne Bruning November 2008
//output
int BUZZER_OUTPUT_PIN=13;
//intput
int RANGE_FINDER_INPUT_PIN=0;
int NUMBER_OF_UNITS_TO_SENSOR=42;
//change units to match your specific user and environment
void setup()
{
pinMode(RANGE_FINDER_INPUT_PIN,INPUT); //sets the range finder analog pin as input
pinMode(BUZZER_OUTPUT_PIN, OUTPUT); // sets the buzzer digital pin as output
digitalWrite(RANGE_FINDER_INPUT_PIN, LOW); // turns the buzzer off
digitalWrite(RANGE_FINDER_INPUT_PIN, HIGH); // turns the buzzer on
beginSerial(9600);
Serial.println("units");
}
void loop()
{
int val = analogRead(RANGE_FINDER_INPUT_PIN);
Serial.println(val); // units
if (val >= 0 & val <= NUMBER_OF_UNITS_TO_SENSOR)
{
digitalWrite( BUZZER_OUTPUT_PIN, HIGH); // turns the buzzer on
}
else
{
digitalWrite( BUZZER_OUTPUT_PIN, LOW); // turns the buzzer off
}
}
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|
















































