Editor Version ×
Standard

1.Easy to use and quick to get started

2.The process supports design scales of 300 devices or 1000 pads

3.Supports simple circuit simulation

4.For students, teachers, creators

Profession

1.Brand new interactions and interfaces

2.Smooth support for design sizes of over 5,000 devices or 10,000 pads

3.More rigorous design constraints, more standardized processes

4.For enterprises, more professional users

Ongoing

STD bike light turning lights

License:

Mode: Editors' pick

  • 656
  • 0
  • 0
Update time: 2021-10-01 20:14:48
Creation time: 2021-07-11 15:19:58
Description


/*   //v12345vtm  [https://www\.youtube\.com/watch?v=2PjL\_NGj\_R0](https://www.youtube.com/watch?v=2PjL_NGj_R0) */ #include "OneButton.h" // Setup a new OneButton on pin A1. OneButton button1(A1, true); // Setup a new OneButton on pin A2. OneButton button2(A2, true); #include \ // How many leds in your strip? #define NUM_LEDS 32 #define DATA_PIN 8 const int ledPin = 13;      // the number of the LED pin // Define the array of leds CRGB leds[NUM_LEDS]; unsigned long eventInterval = 300; unsigned long previousTime = 0; String standvzaken = "drive"; int stand; byte prioriteit = 255 ; //hoe lager het getal hoe belanrijker 0= noodstop bijvoorbeeld int x ;// we mogen geen for loops gebruiken // toggle Variables will change: byte TurnLEFT = LOW;         // the current state of the output pin byte TurnRIGHT = LOW; void setup() {   stand = 0;   x = 0;   pinMode(ledPin, OUTPUT);   Serial.begin(115200);
  // link the button 1 functions.   button1.attachClick(click1);   button1.attachDoubleClick(doubleclick1);   button1.attachLongPressStart(longPressStart1);   button1.attachLongPressStop(longPressStop1);   button1.attachDuringLongPress(longPress1);   // link the button 2 functions.   button2.attachClick(click2);   button2.attachDoubleClick(doubleclick2);   button2.attachLongPressStart(longPressStart2);   button2.attachLongPressStop(longPressStop2);   button2.attachDuringLongPress(longPress2);   FastLED\.addLeds\\(leds\, NUM\_LEDS\);  // GRB ordering is assumed   // [https://alloyui.com/examples/color-picker/hsv.html](https://alloyui.com/examples/color-picker/hsv.html)   FastLED.clear();  // clear all pixel data   FastLED.show();   Serial.print("kleverpinker3");   Serial.println("Starting TwoButtons...");
  //startseq   for (byte x = 0; x   FastLED.clear();  // clear all pixel data   FastLED.show();   delay(250);
  // while (1) {} } void loop() {  //[https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors](https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors)   /* Updates frequently */   unsigned long currentTime = millis();   // keep watching the push buttons:   button1.tick();   button2.tick();   /* This is the event */   if (currentTime - previousTime >= eventInterval) {     /* Event code */     Serial.print (standvzaken);     Serial.print (" stand= " );     Serial.print (stand);     Serial.print (" x= " );     Serial.println (x);     //cases     if (stand  == 5) {       x = 0;       FastLED.clear();  // clear all pixel data       FastLED.show();     }     if (stand  == 1) {       knipperrechts();       FastLED.show();       x = x + 1;     }

    if (stand  == 2) {       knipperlinks();       FastLED.show();       x = x + 1;     }
    if (stand  == 4) {       hazard();//4pinkers       FastLED.show();       x = x + 1;     }
    if (stand  == 0) {       gewoonrijden();//       // FastLED.show();       x = x + 1;     }     /* Update the timing for the next time around */     previousTime = currentTime;   } }
// ----- button 1 callback functions // This function will be called when the button1 was pressed 1 time (and no 2. button press followed). void click1() {   prioriteit = 1 ;   TurnRIGHT = LOW ; //de andere richting afleggen moest dit aan zijn   eventInterval = 1;  //verkort de stand die voorheen bezig was   TurnLEFT = !TurnLEFT;   Serial.println("Button 1 click. LEFT " +   String(prioriteit) + " " + TurnLEFT);   if (TurnLEFT) {     standvzaken = "pinkt TurnLEFT";     stand = 2 ;     x = 0;   }   if (!TurnLEFT) {     standvzaken = "drive";     stand = 0 ;     x=0;   } } // click1
// This function will be called when the button1 was pressed 2 times in a short timeframe. void doubleclick1() {   Serial.println("Button 1 doubleclick.");   standvzaken = "uit";   stand = 5 ;   eventInterval = 1;  //verkort de stand die voorheen bezig was   x=0; } // doubleclick1
// This function will be called once, when the button1 is pressed for a long time. void longPressStart1() {   Serial.println("Button 1 longPress start"); } // longPressStart1
// This function will be called often, while the button1 is pressed for a long time. void longPress1() {   // Serial.println("Button 1 longPress...");   standvzaken = "drive";   stand = 0 ;   eventInterval = 1;  //verkort de stand die voorheen bezig was   TurnLEFT = LOW;         // moesten we hierna willen een pinker aanleggen kan dit   TurnRIGHT = LOW; } // longPress1
// This function will be called once, when the button1 is released after beeing pressed for a long time. void longPressStop1() {   Serial.println("Button 1 longPress stop"); } // longPressStop1
// ... and the same for button 2: void click2() {   prioriteit = 1 ;    eventInterval = 1;  //verkort de stand die voorheen bezig was   TurnLEFT = LOW ; //de andere richting afleggen moest dit aan zijn   TurnRIGHT = ! TurnRIGHT;   Serial.println("Button 2 click. RIGHT " +   String(prioriteit) + " " + TurnRIGHT);   if (TurnRIGHT) {     standvzaken = "pinkt TurnRIGHT";     stand = 1 ;     x = 0 ;   }   if (!TurnRIGHT) {     standvzaken = "drive";     stand = 0 ;     x=0;   } } // click2
void doubleclick2() {   Serial.println("Button 2 doubleclick.");   standvzaken = "alle pinkers";   stand = 4 ;   eventInterval = 1;  //verkort de stand die voorheen bezig was x=0; } // doubleclick2
void longPressStart2() {   Serial.println("Button 2 longPress start"); } // longPressStart2
void longPress2() {   // Serial.println("Button 2 longPress...");   standvzaken = "drive";   stand = 0 ;   x=0;   eventInterval = 1;  //verkort de stand die voorheen bezig was   TurnLEFT = LOW;         // moesten we hierna willen een pinker aanleggen kan dit   TurnRIGHT = LOW; } // longPress2 void longPressStop2() {   Serial.println("Button 2 longPress stop"); } // longPressStop2

void knipperrechts() {   if (x == 0)   {     FastLED.clear();  // clear all pixel data     FastLED.show();   }
  if (x
void knipperlinks() {   if (x == 0)   {     FastLED.clear();  // clear all pixel data     FastLED.show();   }   if (x void   hazard() {   if (x == 0)   {     FastLED.clear();  // clear all pixel data     FastLED.show();     TurnLEFT = LOW;         // moesten we hierna willen een pinker aanleggen kan dit     TurnRIGHT = LOW;   }   if (x

void   gewoonrijden() {   TurnLEFT = LOW;         // moesten we hierna willen een pinker aanleggen kan dit   TurnRIGHT = LOW;   if (true)   {     for (byte y = 0; y     if (x
Design Drawing
schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
ID Name Designator Quantity
1 18650 B2 1
2 1N4148 D1 1
3 WS2812-BAR 8BIT FRONTLEFT,FRONTRIGHT,REARLEFT,REARRIGHT 4
4 LED-0603_R LED1 1
5 K2-3.6×6.1_SMD LEFT,RIGHT 2
6 IRLML9303TRPBF Q1 1
7 BPX43-3 Q2 1
8 10k R1 1
9 100k R2 1
10 1k R3 1
11 Arduini_Nano_Undo U1 1
12 DC DC BOOSTER 5V USB U2 1
13 TP4056 U3 1
14 5V BUZZER U4 1

Unfold

Project Attachments
Order File name Download times
1

2021-07-11 17_53_32-Window.png

1
Project Members
Related Projects
Change a batch
Loading...
Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn