Gadgets

The Rock -VX Gas LED

Als Dank für meine Abonnenten gibt es dieses Mal ein Bau-Video. Ich baue die VX-Gas Rakete/Bombe aus dem Film „THE ROCK“ von 1996. Ich bedanke mich bei allen meinen Abonnenten!!!

Es sieht so einfach aus… ist es auch, aber der Bau dieser Requisite hat mich über 50h gekostet. Die Kugeln wurden aus Epoxidharz gegossen und anschließend auf der Drechselbank geschliffen und poliert. Die Gießform hat einen Grat an der Kugel hinterlassen, der sehr unschön aussah.

Jede Kugel hat einen TPU Verbinder bekommen, der mit einem Drahtring versehen wurde, damit wiederum jede Kugel untereinander mit vier Drähten verbunden werden konnte.

Die Das „Gerüst§ welches normalerweise aus Aluminium ist, habe ich gedruckt, gespachtelt, geschliffen, gespachtelt…. und anschließend lackiert. Bis auf die Alurohre besteht es somit aus Kunststoff. Da alles etwas Kopflastig erschien, habe ich mich für eine lasergeschnittene Bodengruppe entschieden. Das bringt enorme Stabilität.

Die Ansteuerung der WS2812B LED habe ich mit einem Arduino Digispark gelöst. Das Programm hierfür sieht so aus:

#include <Adafruit_NeoPixel.h>

class Strip

{

public:

  uint8_t   effect;

  uint8_t   effects;

  uint16_t  effStep;

  unsigned long effStart;

  Adafruit_NeoPixel strip;

  Strip(uint16_t leds, uint8_t pin, uint8_t toteffects, uint16_t striptype) : strip(leds, pin, striptype) {

    effect = -1;

    effects = toteffects;

    Reset();

  }

  void Reset(){

    effStep = 0;

    effect = (effect + 1) % effects;

    effStart = millis();

  }

};

struct Loop

{

  uint8_t currentChild;

  uint8_t childs;

  bool timeBased;

  uint16_t cycles;

  uint16_t currentTime;

  Loop(uint8_t totchilds, bool timebased, uint16_t tottime) {currentTime=0;currentChild=0;childs=totchilds;timeBased=timebased;cycles=tottime;}

};

Strip strip_0(42, 3, 42, NEO_RGB + NEO_KHZ800);

struct Loop strip0loop0(1, false, 1);

int buttonPin = 2; // Taster an Pin 2

int oldButtonState = HIGH; // Speichert den vorherigen Zustand des Tasters

int program = 0; // Aktuelles Programm

void setup() {

  strip_0.strip.begin();

}

void loop() {

  int buttonState = digitalRead(buttonPin); // Lese den Zustand des Tasters

  if (buttonState != oldButtonState && buttonState == HIGH) {

    // Wenn der Taster gedrückt wird

    program = (program + 1) % 3; // Wechsel zwischen 3 Programmen

    strip_0.Reset();

  }

  oldButtonState = buttonState; // Aktualisiere den vorherigen Zustand des Tasters

  if(strip0_loopX(program) & 0x01)

    strip_0.strip.show();

}

// StripController

uint8_t strip0_loopX(int effect) {

  uint8_t ret = 0x00;

  switch(strip0loop0.currentChild) {

    case 0:

      switch(effect){

        case 0:

          ret = strip0_loop0_eff0();

          break;

        case 1:

          ret = strip0_loop0_eff1();

          break;

        case 2:

          ret = strip0_loop0_eff2();

          break;

        default:

          ret = strip0_loop0_eff0();

      }

      break;

  }

  if(ret & 0x02) {

    ret &= 0xfd;

    if(strip0loop0.currentChild + 1 >= strip0loop0.childs) {

      strip0loop0.currentChild = 0;

      if(++strip0loop0.currentTime >= strip0loop0.cycles) {strip0loop0.currentTime = 0; ret |= 0x02;}

    }

    else {

      strip0loop0.currentChild++;

    }

  };

  return ret;

}

// Effekte

uint8_t strip0_loop0_eff0() {

    // Strip ID: 0 – Effect: Fade – LEDS: 42

    // Steps: 222.22222222222223 – Delay: 9

    // Colors: 2 (0.255.0, 255.255.255)

    // Options: duration=2000, every=1,

  if(millis() – strip_0.effStart < 9 * (strip_0.effStep)) return 0x00;

  uint8_t r,g,b;

  double e;

  e = (strip_0.effStep * 100) / (double)10000;

  r = ( e ) * 100 + 0 * ( 1.0 – e );

  g = ( e ) * 0 + 0 * ( 1.0 – e );

  b = ( e ) * 0 + 0 * ( 1.0 – e );

  for(uint16_t j=0;j<42;j++) {

    if((j % 1) == 0)

      strip_0.strip.setPixelColor(j, r, g, b);

    else

      strip_0.strip.setPixelColor(j, 0, 0, 0);

  }

  if(strip_0.effStep >= 222.22222222222223) {strip_0.Reset(); return 0x03; }

  else strip_0.effStep++;

  return 0x01;

}

uint8_t strip0_loop0_eff1() {

    // Strip ID: 0 – Effect: Rainbow – LEDS: 42

    // Steps: 191 – Delay: 52

    // Colors: 3 (0.10.0, 0.255.0, 0.0.0)

    // Options: rainbowlen=64, toLeft=false,

  if(millis() – strip_0.effStart < 15 * (strip_0.effStep)) return 0x00;

  float factor1, factor2;

  uint16_t ind;

  for(uint16_t j=0;j<42;j++) {

    ind = 191 – (uint16_t)(strip_0.effStep – j * 2.984375) % 191;

    switch((int)((ind % 191) / 63.666666666666664)) {

      case 0: factor1 = 1.0 – ((float)(ind % 191 – 0 * 63.666666666666664) / 63.666666666666664);

              factor2 = (float)((int)(ind – 0) % 191) / 63.666666666666664;

              strip_0.strip.setPixelColor(j, 20 * factor1 + 10 * factor2, 0 * factor1 + 0 * factor2, 0 * factor1 + 0 * factor2);

              break;

      case 1: factor1 = 1.0 – ((float)(ind % 191 – 1 * 63.666666666666664) / 63.666666666666664);

              factor2 = (float)((int)(ind – 63.666666666666664) % 191) / 63.666666666666664;

              strip_0.strip.setPixelColor(j, 20 * factor1 + 0 * factor2, 0 * factor1 + 0 * factor2, 0 * factor1 + 0 * factor2);

              break;

      case 2: factor1 = 1.0 – ((float)(ind % 191 – 2 * 63.666666666666664) / 63.666666666666664);

              factor2 = (float)((int)(ind – 127.33333333333333) % 191) / 63.666666666666664;

              strip_0.strip.setPixelColor(j, 20 * factor1 + 0 * factor2, 0 * factor1 + 0 * factor2, 0 * factor1 + 0 * factor2);

              break;

    }

  }

  if(strip_0.effStep >= 191) {strip_0.Reset(); return 0x03; }

  else strip_0.effStep++;

  return 0x01;

}

uint8_t strip0_loop0_eff2() {

    // Strip ID: 0 – Effect: Fade – LEDS: 42

    // Steps: 31.25 – Delay: 96

    // Colors: 2 (0.255.0, 0.0.12)

    // Options: duration=3000, every=1,

  if(millis() – strip_0.effStart < 200 * (strip_0.effStep)) return 0x00;

  uint8_t r,g,b;

  double e;

  e = (strip_0.effStep * 100) / (double)1000;

  r = ( e ) * 20 + 0 * ( 1.0 – e );

  g = ( e ) * 0 + 0 * ( 1.0 – e );

  b = ( e ) * 0 + 0 * ( 1.0 – e );

  for(uint16_t j=0;j<42;j++) {

    if((j % 1) == 0)

      strip_0.strip.setPixelColor(j, r, g, b);

    else

      strip_0.strip.setPixelColor(j, 0, 0, 0);

  }

  if(strip_0.effStep >= 60.25) {strip_0.Reset(); return 0x03; }

  else strip_0.effStep++;

  return 0x01;

}

5 1 vote
Article Rating
Abonnieren
Benachrichtige mich bei
guest

0 Comments
Inline Feedbacks
View all comments