Things used in this project

Hardware components:
Cutout cortado grande
Punch Through LightBlue Bean
×1
1260 00
Adafruit Flora RGB Neopixel LEDs- Pack of 4
×2
Panasonic eca 1em102
Capacitor 1000 µF
Recommended for Neopixel best practices. I used in conjunction with 3x AAA battery pack.
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
Something in the 100-300 ohm range is recommended for Neopixel best practices. You might not find it necessary.
×1

Schematics

Turn signal vest
Connection Guide. Adafruit's "best practices" recommend 100-300 ohm between signal and first NeoPixel and at least a 1000 µF capacitor across the power input
Untitled%20drawing

Code

Turn signal vestArduino
Bean's accelerometer detects hand signals and displays left or right turn signals on a vest
/*
  Turn signal vest:
  uses Lightblue Bean & Adafruit's Neopixel

  This sketch reads the acceleration from the Bean's accelerometer
  to drive 3 modes

    warn:     flashes Bean orange & vest orange pattern
    left:     flashes Bean green & vest green Left arrow
    right:    flashes Bean blue & vest green right arrow

*/

#include <Adafruit_NeoPixel.h>
#define NEO_PIN 4
#define NEOS 8
#define WRIST_OFF -100
#define WRIST_RIGHT 222
#define WRIST_LEFT_X 180
#define WRIST_LEFT_Y 30
#define WRIST_LEFT_Z -30
#define FLICK -100

// prototypes
void blink_warn( void ) ;
void blink_right(AccelerationReading accel) ;
void blink_left(AccelerationReading accel) ;

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOS, NEO_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Bean.setAccelerationRange(2);    // ensure range of +- 2g
  pixels.begin(); // Initialize NeoPixel library
}

void loop() {
  int i;
  // set mode based on accell, and flash accordinglingly

  AccelerationReading accel = Bean.getAcceleration();
  if ( accel.yAxis > WRIST_RIGHT )        //check for right turn
    blink_right (accel);
  else {  // check for left tutrn
    if ( (accel.xAxis > WRIST_LEFT_X) && (accel.yAxis > WRIST_LEFT_Y) && (accel.zAxis < WRIST_LEFT_Z) )
      blink_left (accel);
    else {
      blink_warn();           //blink_orange
    }
  }
}

void blink_right(AccelerationReading accel) {
  int i;
  do {
    Bean.setLed(0, 0, 110);
    for (i = 3; i < 8; i++)
      pixels.setPixelColor(i, pixels.Color(0, 110, 0));
    pixels.show();
    Bean.sleep(100);
    Bean.setLed(0, 0, 0);
    for (i = 3; i < 8; i++)
      pixels.setPixelColor(i, pixels.Color(0, 0, 0));
    pixels.show();
    for (i = 0; i < 5; i++) { // check in 100 ms intervals so you don't miss wrist flick
      Bean.sleep(100);
      accel = Bean.getAcceleration();
      if (accel.zAxis < FLICK) {    // check for wrist flick
        Bean.sleep(400);          // let wrist flick reset w/o triggering a left turn
        return;
      }
    }
  } while (1);
}

void blink_left(AccelerationReading accel) {
  int i;
  do {
    Bean.setLed(0, 110, 0);
    for (i = 0; i < 4; i++)
      pixels.setPixelColor(i, pixels.Color(0, 110, 0));
    pixels.setPixelColor(7, pixels.Color(0, 110, 0));
    pixels.show();
    Bean.sleep(100);
    Bean.setLed(0, 0, 0);
    for (i = 0; i < 4; i++)
      pixels.setPixelColor(i, pixels.Color(0, 0, 0));
    pixels.setPixelColor(7, pixels.Color(0, 0, 0));
    pixels.show();
    for (i = 0; i < 5; i++) { // check in 100 ms intervals so you don't miss wrist flick
      Bean.sleep(100);
      accel = Bean.getAcceleration();
      if (accel.zAxis < FLICK) {    // check for wrist flick
        Bean.sleep(400);          // let wrist flick reset w/o triggering a left turn
        return;
      }
    }
  } while (1);
}

void blink_warn( void ) {
  int i;
  Bean.setLed(70, 50, 0);
  for (i = 0; i < 8; i += 2)
    pixels.setPixelColor(i, pixels.Color(80, 50, 0));
  pixels.show();
  Bean.sleep(100);
  Bean.setLed(0, 0, 0);
  for (i = 0; i < 8; i += 2)
    pixels.setPixelColor(i, pixels.Color(0, 0, 0));
  pixels.show();
  Bean.sleep(400);
  for (i = 1; i < 8; i += 2)
    pixels.setPixelColor(i, pixels.Color(80, 50, 0));
  pixels.show();
  Bean.sleep(100);
  for (i = 1; i < 8; i += 2)
    pixels.setPixelColor(i, pixels.Color(0, 0, 0));
  pixels.show();
  Bean.sleep(400);
}

Credits

Me
Carol Chesney

Mechanical engineer and teacher

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Web-controlled BoE-Shield Robot with the LightBlue Bean[+]
Intermediate
  • 830
  • 22

Full instructions

Have you ever wanted to control a robot from a web browser? Use the LightBlue Bean[+] (LBB[+]) to control a BoE-Shield Robot using BLE.

RadBit
Intermediate
  • 1,093
  • 19

FitBit-type Bluetooth radiation sensor for tracking radiation exposure (for working around X-rays in the hospital, or just life in general).

Handy BLE app / Bean Car
Intermediate
  • 4,187
  • 29

Work in progress

Remote control bean powered car driven with an iPhone running the Handy BLE app.

El Wire T-shirt: Connected to a LightBlue Bean
Intermediate
  • 285
  • 6

Work in progress

A custom Internet connected shirt using a LightBlue Bean to light up the shirt's El Wire graphics.

Data Pyrotechnics
Intermediate
  • 552
  • 7

Full instructions

What happens when you strap a LightBlue Bean to some fireworks?

Water Detection System
Intermediate
  • 2,888
  • 23

Full instructions

Send email alerts with LightBlue Bean using Node-RED on Raspberry Pi

Add projectSign up / Login