Pioneering Robotics & AI Solutions for Defence & Industrial Automation
Loading innovation...
Design breathing, strobe, or heartbeat LED animations and export them as a ready-to-flash C loop for Arduino, STM32, or ESP boards.
Loop duration: 1809 ms
| Step | Duty | Hold (ms) |
|---|---|---|
| #1 | 0 | 67 |
| #2 | 31 | 67 |
| #3 | 61 | 67 |
| #4 | 90 | 67 |
| #5 | 119 | 67 |
| #6 | 145 | 67 |
| #7 | 169 | 67 |
| #8 | 191 | 67 |
| #9 | 210 | 67 |
| #10 | 226 | 67 |
| #11 | 238 | 67 |
| #12 | 248 | 67 |
| #13 | 253 | 67 |
| #14 | 255 | 67 |
| #15 | 253 | 67 |
| #16 | 248 | 67 |
| #17 | 238 | 67 |
| #18 | 226 | 67 |
| #19 | 210 | 67 |
| #20 | 191 | 67 |
| #21 | 169 | 67 |
| #22 | 145 | 67 |
| #23 | 119 | 67 |
| #24 | 90 | 67 |
| #25 | 61 | 67 |
| #26 | 31 | 67 |
| #27 | 0 | 67 |
#include <Arduino.h>
#define LED_PIN 9
struct Step { uint16_t duty; uint16_t ms; };
const Step pattern[] = {
{ 0, 67 },
{ 31, 67 },
{ 61, 67 },
{ 90, 67 },
{ 119, 67 },
{ 145, 67 },
{ 169, 67 },
{ 191, 67 },
{ 210, 67 },
{ 226, 67 },
{ 238, 67 },
{ 248, 67 },
{ 253, 67 },
{ 255, 67 },
{ 253, 67 },
{ 248, 67 },
{ 238, 67 },
{ 226, 67 },
{ 210, 67 },
{ 191, 67 },
{ 169, 67 },
{ 145, 67 },
{ 119, 67 },
{ 90, 67 },
{ 61, 67 },
{ 31, 67 },
{ 0, 67 }
};
const size_t patternCount = sizeof(pattern) / sizeof(pattern[0]);
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
for (size_t i = 0; i < patternCount; i++) {
analogWrite(LED_PIN, pattern[i].duty);
delay(pattern[i].ms);
}
}
Use `analogWrite` on AVR, `ledcWrite` on ESP32, or your timer compare macro on STM32.
For 12-bit timers, set PWM max to 4095 so the duty numbers map directly.