Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is not supported at present. Please extend your EasyEDA usage duration and try again.
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
/*
//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
Forked project will be set private in personal workspace. Do you continue?
Clone
Project
The Pro editor is about to be opened to save as. Do you want to continue?
private message
Send message to v12345vtm
Delete
Comment
Are you sure to delete the comment?
Report
bike light turning lights
bike turn signal lights
Announcer: v12345vtm
Creation time: 2021-07-11 15:19:58
Published time:
2021-10-01 20:14:48
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
*
Report type:
Please select report type
*
Report reason:
Please fill in the reason for your report and the content is 2-1000
words
*
Upload image:
+
Upload image
*
Email address:
Please fill in your email address
Report
Submitted successfully! The review result can be viewed in the personal
center, review notification.
Kind tips
Your EasyEDA usage duration is brief. In order to avoid advertising information, this action is
not supported at present. Please extend your EasyEDA usage duration and try again.
Share
Project
Copy
Copy
Scan the QR code and open it on the mobile terminal