张三叔

bicycle hot wheels arduino

 
Overview

Using Arduino as main control, this is the first generation product and will be improved in the future.IMG_20200821_210153.jpgIMG_20200820_111956.jpgIMG_20200822_084103.jpg



This is the supporting arduino program

#include <FastLED.h>
#define LED_PIN     3
#define NUM_LEDS    14
CRGB leds[NUM_LEDS];
void setup() {
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
    leds[0] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
    leds[2] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
     leds[4] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
      leds[6] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
    leds[8] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
     leds[10] = CRGB ( 111, 111, 111);
  FastLED.show();
  delay(1000);
}

void loop() {

for(int a = 0; a <= 13; a++)
{
    for (int i = 0; i <= 13; i++) {
        leds[i] = CRGB ( 0, 0, 0);
        FastLED.show();
      }
  leds[a] = CRGB ( 0, 0, 255);
   FastLED.show();
   delay(100);
}

for(int a = 0; a <= 13; a++)
{
    for (int i = 0; i <= 13; i++) {
        leds[i] = CRGB ( 0, 0, 0);
        FastLED.show();
      }
  leds[a] = CRGB ( 0, 255, 0);
   FastLED.show();
   delay(100);
}

for(int a = 0; a <= 13; a++)
{
    for (int i = 0; i <= 13; i++) {
        leds[i] = CRGB ( 0, 0, 0);
        FastLED.show();
      }
  leds[a] = CRGB ( 255, 0, 0);
   FastLED.show();
   delay(100);
}

  for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(110);
  }
  for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 0, 255, 0);
    FastLED.show();
    delay(110);
  }
    for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 0, 0, 255);
    FastLED.show();
    delay(110);
  }

for(int b = 170; b < 255; b++)
{
     for (int i = 0; i <= 13; i++) 
     {
      leds[i] = CRGB ( b, b, 0);
      FastLED.show();
      delay(10);
    }

     for (int i = 0; i <= 13; i++) 
     {
      leds[i] = CRGB ( b, 0, b);
      FastLED.show();
      delay(10);
    }

    for (int i = 0; i <= 13; i++) 
     {
      leds[i] = CRGB ( 0, b, b);
      FastLED.show();
      delay(10);
    }
}

  for (int k = 0; k <= 5; k++)
  {

  for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(30);
  }
  for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 0, 255, 0);
    FastLED.show();
    delay(30);
  }
    for (int i = 0; i <= 13; i++) {
    leds[i] = CRGB ( 0, 0, 255);
    FastLED.show();
    delay(30);
  }

  }
}
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-07 12:37:27

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号