Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define LED_PIN 3
- //#define DATA_PIN 4
- #define NUM_LEDS 14
- #define LED_TYPE WS2812B
- #define COLOR_ORDER GRB
- #define BRIGHTNESS 5
- CRGB leds[NUM_LEDS];
- /**
- * file: Mini Plane
- * author: Davcio
- *
- * description:
- * Beleuchtung des Kruemers V12 Motor
- * und Soundmodulsteuerung
- *
- * date: 06.11.2019
- * version: 0.1
- */
- int Zeit_zw_zylinder;
- int Zeit_Zuendung;
- int NEO_LED_NR;
- int Zuendung_AN = 7;
- int Motor_AN = 9;
- unsigned long ZeitbisBlink1_Rot;
- unsigned long ZeitbisBlink1_Gruen;
- unsigned long Motor_Lauft_Z0;
- unsigned long Motor_Lauft_Z1;
- unsigned long Motor_Lauft_Z2;
- unsigned long Motor_Lauft_Z3;
- unsigned long Motor_Lauft_Z4;
- unsigned long Motor_Lauft_Z5;
- unsigned long Motor_Lauft_Z6;
- unsigned long Motor_Lauft_Z7;
- unsigned long Motor_Lauft_Z8;
- unsigned long Motor_Lauft_Z9;
- unsigned long Motor_Lauft_Z10;
- unsigned long Motor_Lauft_Z11;
- void setup() {
- delay(1000);
- LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
- // LEDS.addLeds<LED_TYPE, LED_PIN, CLOCK_PIN COLOR_ORDER>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- pinMode(Zuendung_AN, INPUT_PULLUP);
- pinMode(Motor_AN, INPUT_PULLUP);
- Serial.begin(9600);
- ZeitbisBlink1_Rot = millis();
- ZeitbisBlink1_Gruen = millis();
- Motor_Lauft_Z0 = millis();
- Motor_Lauft_Z1 = millis();
- Motor_Lauft_Z2 = millis();
- Motor_Lauft_Z3 = millis();
- Motor_Lauft_Z4 = millis();
- Motor_Lauft_Z5 = millis();
- Motor_Lauft_Z6 = millis();
- Motor_Lauft_Z9 = millis();
- Motor_Lauft_Z8 = millis();
- Motor_Lauft_Z9 = millis();
- Motor_Lauft_Z10 = millis();
- Motor_Lauft_Z11 = millis();
- }
- void loop() {
- if(! digitalRead(Zuendung_AN) ) {
- //Merlin motor Start
- Zeit_zw_zylinder = 50;
- Zeit_Zuendung = 10;
- if( millis() - Motor_Lauft_Z0 >= 100) {
- NEO_LED_NR = 0;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR, millis() - Motor_Lauft_Z0 );
- }
- if( millis() - Motor_Lauft_Z0 >= 110) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z11 >= 200) {
- NEO_LED_NR = 11;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,millis() - Motor_Lauft_Z11);
- }
- if( millis() - Motor_Lauft_Z11 >= 210) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z3 >= 500) {
- NEO_LED_NR = 3;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR, millis() - Motor_Lauft_Z3 );
- }
- if( millis() - Motor_Lauft_Z3 >= 510) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z8 >= 700) {
- NEO_LED_NR = 8;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR, Motor_Lauft_Z8);
- }
- if( millis() - Motor_Lauft_Z8 >= 710) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z1 >= 900) {
- NEO_LED_NR = 1;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z1);
- }
- if( millis() - Motor_Lauft_Z1 >= 910) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z10 >= 1100) {
- NEO_LED_NR = 10;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR, Motor_Lauft_Z10);
- }
- if( millis() - Motor_Lauft_Z10 >= 1110) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z5 >= 1300) {
- NEO_LED_NR = 5;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z5);
- }
- if( millis() - Motor_Lauft_Z5 >= 1310) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z6 >= 1500) {
- NEO_LED_NR = 6;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z6);
- }
- if( millis() - Motor_Lauft_Z6 >= 1510) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z2 >= 1700) {
- NEO_LED_NR = 2;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z2);
- }
- if( millis() - Motor_Lauft_Z2 >= 1710) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z9 >= 1900) {
- NEO_LED_NR = 9;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z9);
- }
- if( millis() - Motor_Lauft_Z9 >= 1910) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z4 >= 2000) {
- NEO_LED_NR = 4;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z4);
- }
- if( millis() - Motor_Lauft_Z4 >= 2010) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- }
- if( millis() - Motor_Lauft_Z7 >= 2100) {
- NEO_LED_NR = 7;
- leds[NEO_LED_NR] = CRGB::Red;
- FastLED.show();
- Serial.println(NEO_LED_NR,Motor_Lauft_Z7);
- }
- if( millis() - Motor_Lauft_Z7 >= 2110) {
- leds[NEO_LED_NR].setRGB(0,0,0);
- FastLED.show();
- Motor_Lauft_Z0 = millis();
- Motor_Lauft_Z1 = millis();
- Motor_Lauft_Z2 = millis();
- Motor_Lauft_Z3 = millis();
- Motor_Lauft_Z4 = millis();
- Motor_Lauft_Z5 = millis();
- Motor_Lauft_Z6 = millis();
- Motor_Lauft_Z7 = millis();
- Motor_Lauft_Z8 = millis();
- Motor_Lauft_Z9 = millis();
- Motor_Lauft_Z10 = millis();
- Motor_Lauft_Z11 = millis();
- }
- //Pos_Light Gruen EIN
- if(millis() - ZeitbisBlink1_Gruen >= 1000) {
- leds[12].setRGB(0,255,0);
- FastLED.show();
- }
- //Pos_Light Gruen AUS
- if(millis() - ZeitbisBlink1_Gruen >= 1020) {
- leds[12].setRGB(0,0,0);
- FastLED.show();
- }
- //Pos_Light Gruen EIN
- if(millis() - ZeitbisBlink1_Gruen >= 1200) {
- leds[12].setRGB(0,255,0);
- FastLED.show();
- }
- //Pos_Light Gruen AUS
- if(millis() - ZeitbisBlink1_Gruen >= 1230) {
- leds[12].setRGB(0,0,0);
- FastLED.show();
- ZeitbisBlink1_Gruen = millis();
- }
- //Pos_Light Rot EIN
- if(millis() - ZeitbisBlink1_Rot >= 1000) {
- leds[13] = CRGB::Red;
- FastLED.show();
- }
- //Pos_Light Rot AUS
- if(millis() - ZeitbisBlink1_Rot >= 1020) {
- leds[13].setRGB(0,0,0);
- FastLED.show();
- }
- //Pos_Light Rot EIN
- if(millis() - ZeitbisBlink1_Rot >= 1200) {
- leds[13] = CRGB::Red;
- FastLED.show();
- }
- //Pos_Light Rot AUS
- if(millis() - ZeitbisBlink1_Rot >= 1230) {
- leds[13].setRGB(0,0,0);
- FastLED.show();
- ZeitbisBlink1_Rot = millis();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement