Project
Read moreI made the King of Darkness EVIL's hand. The way of lighting changes depending on the movement of the motion sensor.
“King of Darkness” EVIL is a professional wrestler in New Japan Professional Wrestling. He emits evil rays from his hand.
ComponentsDepending on the attitude of the motion sensor BNO055, it controls the NeoPixel Ring (RED Light) and 4 NeoPixels (GREEN Light).
EVIL GloveI placed the NeoPixel Ring in the palm of the hand, 1 unit NeoPixel on 4 fingertips, and the rest on the back of the hand.
Arduino IDE Program#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <Adafruit_NeoPixel.h>
/* Set the delay between fresh samples */
#define BNO055_SAMPLERATE_DELAY_MS (10)
Adafruit_BNO055 bno = Adafruit_BNO055();
Adafruit_NeoPixel ring = Adafruit_NeoPixel(12, 6, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 9, NEO_GRB + NEO_KHZ800);
int z;
int bright = 255;
unsigned long time;
void setup(void) {
Serial.begin(9600);
Serial.println("Orientation Sensor Raw Data Test"); Serial.println("");
/* Initialise the sensor */
if(!bno.begin()) {
/* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}
delay(1000);
bno.setExtCrystalUse(true);
Serial.println("Calibration status values: 0=uncalibrated, 3=fully calibrated");
ring.begin();
strip.begin();
ring.show(); // Initialize all pixels to 'off'
strip.show(); // Initialize all pixels to 'off'
ring.setBrightness(bright);
strip.setBrightness(bright);
}
/**************************************************************************/
/*
Arduino loop function, called once 'setup' is complete (your own code
should go here)
*/
/**************************************************************************/
void loop(void) {
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);
z = event.orientation.z;
/* Display the floating point data Z*/
Serial.print("\tZ: ");
Serial.println(z);
if(abs(z) > 130){
time = millis();
strip.clear();
strip.show();
for(uint16_t i=0; i<ring.numPixels(); i++) {
ring.setPixelColor(i, ring.Color(255, 0, 0));
}
ring.show();
//The palm light turns red
while(millis() - time < 4000){
Serial.println("RED Light");
bno.getEvent(&event);
z = event.orientation.z;
if(abs(z) < 130){
break;
}
}
//The palm blinking red
while(abs(z) > 130){
Serial.println("RED Flash");
for(uint16_t i=0; i<ring.numPixels(); i++) {
ring.setPixelColor(i, ring.Color(255, 0, 0));
}
ring.show();
delay(50);
ring.clear();
ring.show();
delay(50);
bno.getEvent(&event);
z = event.orientation.z;
}
}else{
ring.clear();
ring.show();
//Fingertips lit in green
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, strip.Color(0, 255, 0));
}
strip.show();
}
delay(BNO055_SAMPLERATE_DELAY_MS);
}
OperationThis is EVIL! Everything is EVIL!
Comments