1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Question adjustable red line for rpm, with ws2812b leds and arduino

Discussion in 'DIY peripherals' started by minimus1899, Oct 19, 2017.

  1. minimus1899

    minimus1899 Member

    Joined:
    Mar 7, 2016
    Messages:
    65
    Occupation:
    retired/broken/falling to bit
    Location:
    lincoln
    Balance:
    163Coins
    Ratings:
    +58 / 1 / -0
    My Motion Simulator:
    Arduino
    hi all need hel pon a project im working on ive got the basic code setup so i can addust what coulors are on which leds but im wanting to be able to use a pot to change the red lights for the redline on the rpm gauge


    problem is im not that good at coding, so im asking for yuo help to finish this and then do a tut to let everyone know,

    the program is simple..... ish

    there aee ws2812b leds and i have the 5v and gnd connect to the arduino and the data pin to pin 4


    now i now that i can add a pot to this on a analog.read pin but i dont know how to right the come for the pot to change the leds from blue to red and vis verser

    heres a pic of my project so far..

    20171019_004122.jpg

    this is my code i have so far, really want to get this working and i really need the help

    kind regards

    andy

    Code:
    #include <FastLED.h>
    
    #define LED_PIN     4
    #define NUM_LEDS    10
    #define LED_TYPE    WS2812B
    #define COLOR_ORDER GRB
    #define BRIGHTNESS  64
    
    CRGB leds[NUM_LEDS];
    
    void setup() {
        delay(1000);
        LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
        FastLED.setBrightness(BRIGHTNESS);
    } // setup ()
    
    void loop() {         // 0 is the first led ie: 1 ...... so if 10 led itll be 0 to 9 on the crgb led num
    
      leds[0] = CRGB::Blue;
      leds[1] = CRGB::Blue;
      leds[2] = CRGB::Blue;
      leds[3] = CRGB::Blue;
      leds[4] = CRGB::Blue;
      leds[5] = CRGB::Blue;
      leds[6] = CRGB::Blue;
      leds[7] = CRGB::Red;
      leds[8] = CRGB::Red;
      leds[9] = CRGB::Red;
    
      FastLED.show();
    
    } // loop ()
  2. minimus1899

    minimus1899 Member

    Joined:
    Mar 7, 2016
    Messages:
    65
    Occupation:
    retired/broken/falling to bit
    Location:
    lincoln
    Balance:
    163Coins
    Ratings:
    +58 / 1 / -0
    My Motion Simulator:
    Arduino
    Hey guys

    I've made a tutorial on how to do this in the diy peripherals called adjustable rpm leds

    I figured out how to do this with my brother who is great a c++ as he is working with it a lot and Arduino ide is kind of like c++ so he made this possible go check it out

    Kind regards

    Andy