Project tutorial
Heart Attack with LED

Heart Attack with LED © CC BY-SA

We tried to make a project called "Heart Attack with LED". This is different. Because it will be a gift for your lover.

  • 877 views
  • 0 comments
  • 4 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

About this project

We tried to make a project called "Heart Attack with LED". This is different. Because it will be a gift for your lover. Your heart will beat for her or him.

What is a heart attack?

A heart attack occurs when the flow of blood to the heart is blocked, most often by a build-up of fat, cholesterol and other substances, which form a plaque in the arteries that feed the heart. God bless you…

In this project, we are using again the Arduino Nano, some electronic materials and also 3D printing parts. We hope you will like it too. It is a very simple and very cheap gift.

And if you want to make this "Heart Attack with LED", you need 3D printing files and Arduino codes. You can find all files in the below link for downloads.

Code

Arduino Nano CodeArduino
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

#define NEO_PIN 6           // Neopixel pin
#define GND_PIN 9           // Signal pin used as ground
#define GND_PIN2 1          // Signal pin used as ground
#define SPEED_PIN A4       // Analog (ADC) input pin to read value of speed potentiometer
#define COLOR_PIN A5       // Analog (ADC) input pin to read value of color potentiometer
#define MAX_BRIGHTNESS 50   // Maximum Neopixel brightness
#define UP_STEPS 5          // Increasing brightness steps out of the total number of steps (smaller than half total => fast rise, slow decay)
#define TOTAL_STEPS 40      // Total number of increasing/deeasing steps
#define SPEED_DIVIDER 30    // Used to divide the value of the speed ADC readout to calculate iteration delay

const int heart[] = {       // Heart bitmap
  0, 1, 1, 0, 1, 1, 0, 0,
  1, 1, 1, 1, 1, 1, 1, 0,
  1, 1, 1, 1, 1, 1, 1, 0,
  1, 1, 1, 1, 1, 1, 1, 0,
  0, 1, 1, 1, 1, 1, 0, 0,
  0, 0, 1, 1, 1, 0, 0, 0,
  0, 0, 0, 1, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0
};

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(4, 4, 2, 2, NEO_PIN,
  NEO_TILE_TOP   + NEO_TILE_LEFT   + NEO_TILE_COLUMNS   + NEO_TILE_ZIGZAG +
  NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
  NEO_GRB + NEO_KHZ800);

void setup() {
  matrix.begin();
  matrix.setBrightness(40);

  pinMode(GND_PIN, OUTPUT);
  digitalWrite(GND_PIN, LOW); // Lazy ground
  pinMode(GND_PIN2, OUTPUT);
  digitalWrite(GND_PIN2, LOW); // Lazy ground
  pinMode(SPEED_PIN, INPUT);
  pinMode(COLOR_PIN, INPUT);
}

void loop() {
  int i, j;
  int brightness;
  int color;
  
  for (i = 0; i < TOTAL_STEPS; i++) {
    if (i < UP_STEPS)
      brightness = MAX_BRIGHTNESS * i / UP_STEPS;
    else
      brightness = MAX_BRIGHTNESS * (TOTAL_STEPS - i - 1) / (TOTAL_STEPS - UP_STEPS);
    matrix.setBrightness(brightness);
    color = analogRead(COLOR_PIN) / 4;
    
    for (j = 0; j < 64; j++) {
      
      matrix.drawPixel(j / 8, j % 8, Wheel(color)*heart[j]);
      
    }
    
    
    matrix.show();
    delay(analogRead(SPEED_PIN) / SPEED_DIVIDER);
  }
}

uint32_t Wheel(byte WheelPos) { // Courtesy of multiple Adafruit examples
  if (WheelPos < 85) {
    return matrix.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return matrix.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return matrix.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

Schematics

Circuit
Circuit333 6fomzx49rw

Comments

Similar projects you might like

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,343 views
  • 4 comments
  • 34 respects

Neopixel LED EyeBall

Project tutorial by HomeMadeGarbage

  • 5,402 views
  • 22 comments
  • 21 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 10,022 views
  • 5 comments
  • 20 respects

Prevention of heart attack

Project tutorial by Mahdi Hajebi

  • 7,663 views
  • 5 comments
  • 18 respects

Valentine Blink: Voice Controlled LED Heart

Project showcase by AdiK

  • 7,681 views
  • 0 comments
  • 21 respects

Robotics LED Strip

Project tutorial by Arduino “having11” Guy

  • 3,203 views
  • 3 comments
  • 13 respects
Add projectSign up / Login