Final Project Bike Watch

on

Daeleown Cox

With my final project I combined two works of art to create something new. This bike watch is used as a turn signal for local cyclist. With everyone going towards a greener earth, and less pollution I fell as if this will gain popularity. The watch turns on by motion, it turns yellow with a blinking flash for a right turn. A left turn will also be yellow but the light  doesn’t blink.  This will help cyclist that likes to ride at night.

 

Material :

3D print

Circuit playground

Lithium ion battery

Coding:

///////////////////////////////////////////////////////////////////////////////
// Circuit Playground Bike Glove – With “On/Off”
//
// Author: Carter Nelson
// MIT License (https://opensource.org/licenses/MIT)

#include <Adafruit_CircuitPlayground.h>

#define THRESHOLD_UP 5 // threshold for hand up test
#define THRESHOLD_RIGHT 5 // threshold for right turn
#define THRESHOLD_LEFT -5 // threshold for left turn

#define BRIGHTNESS 255
#define LEFT_COLOR 0xffff00
#define RIGHT_COLOR 0xffff00
#define ANIM_DELAY 200

///////////////////////////////////////////////////////////////////////////////
void leftTurnAnimation() {
// just to be sure, turn off all NeoPixels
CircuitPlayground.clearPixels();

// Turn on 5 & 4
CircuitPlayground.setPixelColor(5, LEFT_COLOR);
CircuitPlayground.setPixelColor(4, LEFT_COLOR);
delay(ANIM_DELAY);
CircuitPlayground.clearPixels();

// Turn on 6 & 3
CircuitPlayground.setPixelColor(6, LEFT_COLOR);
CircuitPlayground.setPixelColor(3, LEFT_COLOR);
delay(ANIM_DELAY);
CircuitPlayground.clearPixels();

// Turn on 7 & 2
CircuitPlayground.setPixelColor(7, LEFT_COLOR);
CircuitPlayground.setPixelColor(2, LEFT_COLOR);
delay(ANIM_DELAY);
CircuitPlayground.clearPixels();

// Turn on 8 & 1
CircuitPlayground.setPixelColor(8, LEFT_COLOR);
CircuitPlayground.setPixelColor(1, LEFT_COLOR);
delay(ANIM_DELAY);
CircuitPlayground.clearPixels();

// Turn on 9 & 0
CircuitPlayground.setPixelColor(9, LEFT_COLOR);
CircuitPlayground.setPixelColor(0, LEFT_COLOR);
delay(ANIM_DELAY);
CircuitPlayground.clearPixels();
}

///////////////////////////////////////////////////////////////////////////////
void rightTurnAnimation() {
// just to be sure, turn off all NeoPixels
CircuitPlayground.clearPixels();

// turn on NeoPixels to make an arrow shape
CircuitPlayground.setPixelColor(2, RIGHT_COLOR);
CircuitPlayground.setPixelColor(5, RIGHT_COLOR);
CircuitPlayground.setPixelColor(6, RIGHT_COLOR);
CircuitPlayground.setPixelColor(7, RIGHT_COLOR);
CircuitPlayground.setPixelColor(8, RIGHT_COLOR);
CircuitPlayground.setPixelColor(9, RIGHT_COLOR);

// wait a little bit
delay(ANIM_DELAY);

// turn them all off
CircuitPlayground.clearPixels();

// wait again
delay(ANIM_DELAY);
}

///////////////////////////////////////////////////////////////////////////////
void setup() {
CircuitPlayground.begin(BRIGHTNESS);
}

///////////////////////////////////////////////////////////////////////////////
void loop() {
// check slide switch position
if (CircuitPlayground.slideSwitch()) {

// check for hand up or down
if (CircuitPlayground.motionZ() > THRESHOLD_UP) {

// do nothing

} else {

// check for right turn
if (CircuitPlayground.motionX() > THRESHOLD_RIGHT) {
rightTurnAnimation();

// check for left turn
} else if (CircuitPlayground.motionY() < THRESHOLD_LEFT) {
leftTurnAnimation();

}
}
}

67096087341__C88458EA-1ED0-4A54-B993-698BB61305A5

 

Leave a Reply