New answers tagged

0

One of the SimpleTimer libraries such as this one by Marcello Romani (which I mention because I have used it; there are others). It creates a timers object that has 10 (in this case) software-based timers with a variety of operating modes (run once, run x times, run forever, e.g.). The basic idea (for a 1-LED example) is that you write a function (known as a ...


0

A small update to your code Added lcd.begin(); function added lcd.clear(); function so that old characters will be removed before adding new display Here is the complete code int red = 10; int yellow = 9; int green = 8; #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { lcd.begin(16, 2); pinMode(red, OUTPUT); ...


3

You have written your question beautifully. In your case, according to your logic, the button has to be kept pressed, so that the LEDs are lit in the order you desire. The single loop() function is part of the Arduino sketch but it is never a limitation. One way to solve your problem is to make the LED drive logic independent of the button press state. Once ...


5

By using delay() it blocks the rest of the code. The programme needs to keep track of two buttons and update the lightshow at appropriate times, therefore a non-blocking style of coding is needed similar to the Blink Without Delay example where the delay() is replaced with a timer using millis() that is checked periodically. This allows other things to be ...


2

You simply need to save the state of the LEDs in a new variable ... void loop () { if (digitalRead(buttonON)== LOW) ledEffectON = true; if (digitalRead(buttonOFF)== LOW) ledEffectON = false; if(ledEffectON) { delay(300), digitalWrite(LED1, HIGH); delay(50), digitalWrite(LED2, HIGH); delay(50), digitalWrite(LED3, HIGH); ...


3

If you want the display to persist, you should call drawScreen() on every loop iteration. You will need a variable for “remembering” what glyph you should draw. Then, the serial-processing code has only to update this variable when a new character is received: // Remember which glyph we should draw. byte *glyph = Zero; void loop() { if (Serial.available(...


1

Your drawScreen() function executes very quickly and therefore, lights the LEDs once, very briefly. There are a few choices; here are a couple to try: One is to write surround the existing for{} loop in drawScreen() with another one, to redisplay the digit enough times to make it visible. Experiment with the count of the outer loop starting with, maybe, ...


1

update in 2021, similar problem, fastLED causing unintelligible IR codes, adding that while loop: while (!irrecv.isIdle()); // if not idle, wait till complete just before the ir check worked for me, not 100% of the codes are correct but more than good enough for my use, you life saver


0

Assuming the LED is to respond at anytime when the button is pressed, then consider changing from using delay() to using millis(). Once this is done, consider approaching this problem treating it like a state machine in which all possible states are defined and all events triggering a change to the next state are well understood. Briefly this problem may ...


1

Quick answer is probably not. Why? The numbers don't add up: ...3,2V/20mA for the 100 LEDs... From here we find this comment: Most common LED’s require a forward operating voltage of between approximately 1.2 to 3.6 volts with a forward current rating of about 10 to 30 mA, with 12 to 20 mA being the most common range. (Actually there are low current ...


0

As StarCat said in a comment on your question, you are going to potentially have to supply 100 amps to the string! This would be a massive sized cable, to say nothing of the problem of finding 100 amps from your 12V battery. You may have to size down your expectations a bit, or maybe use a LED strip that doesn't require as much as that. Your question doesn't ...


Top 50 recent answers are included