r Linte
Published © MIT

Angry Iron Fist

When you angry; just fist!

BeginnerFull instructions provided1 hour1,374
Angry Iron Fist

Things used in this project

Hardware components

Grove Shield for Arduino Nano
×1
Seeeduino Nano
×1
Grove - MP3 V3 -Music Player
×1
Grove - 6-Axis Accelerometer&Gyroscope
×1
SD Card
×1
Battery
×1
Grove - Universal 4 Pin Buckled 20cm Cable (5 PCs pack)
×1
Mono Enclosed Speaker - 2W 6 Ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE
AutoCAD

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Hot melt glue gun.
electric soldering iron

Story

Read more

Custom parts and enclosures

ring_SErWgHnBNC.dxf

new_box_ePlOnq54N9.dxf

Code

angry_iron_fist.ino

C/C++
#include <MsTimer2.h>
#include "Adafruit_NeoPixel.h"
#include "WT2003S_Player.h"
#include "SparkFunLSM6DS3.h"
#include "Wire.h"
#ifdef __AVR__
#include <avr/power.h>
#endif
#ifdef __AVR__
#include <SoftwareSerial.h>
SoftwareSerial SSerial(2, 3); // RX, TX
#define COMSerial SSerial
WT2003S<SoftwareSerial> Mp3Player;
#endif
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define COMSerial Serial1
WT2003S<Uart> Mp3Player;
#endif
#ifdef ARDUINO_ARCH_STM32F4
#define COMSerial Serial
WT2003S<HardwareSerial> Mp3Player;
#endif
uint8_t vol = 3;
uint32_t spi_flash_songs = 0;
uint32_t sd_songs = 0;
STROAGE workdisk = SD;
//LED
#define PIN 6
#define NUMPIXELS      20
#define BRIGHTNESS 255
//accelmeter
LSM6DS3 myIMU( I2C_MODE, 0x6A );  //I2C device address 0x6A
float x=0;
float y=0;
float z=0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
int xxx=15;
int i=0;
int Timer=1000;
int tick = 0;
void onTimer()
{
//   Serial.println("Device error");
strip. clear();
strip.setPixelColor(i-4, strip.Color(50,0,0)); // Moderately bright red color.
strip.setPixelColor(i-3, strip.Color(100,0,0)); // Moderately bright red color.
strip.setPixelColor(i-2, strip.Color(150,0,0)); // Moderately bright red color.
strip.setPixelColor(i-1, strip.Color(200,0,0)); // Moderately bright red color.
strip.setPixelColor(i, strip.Color(255,0,0)); // Moderately bright red color
strip.show();
i=i+1;
if(i >= NUMPIXELS){
i = 0;
}
}
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
//  Serial.begin(115200);
myIMU.begin();
COMSerial.begin(9600);
Mp3Player.init(COMSerial);
Mp3Player.volume(vol);
strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
MsTimer2::set(Timer, onTimer);
MsTimer2::start();
}
void loop() {
x=myIMU.readFloatAccelX();
y=myIMU.readFloatAccelY();
z=myIMU.readFloatAccelZ();
//   Serial.println("x:");
//   Serial.println(x);
if(x>0.8){
Timer=Timer-50;
if(Timer <= 50){
Timer=100;
Mp3Player.playSDRootSong(0x0002);
}
else{
Mp3Player.playSDRootSong(0x0001);
}
MsTimer2::set(Timer, onTimer);
MsTimer2::start();
}
delay(500);
}

Credits

r Linte

r Linte

3 projects • 9 followers

Comments