Thank you. Yes, that works. I made this for a ~linear looking heartbeat:
Code:
#define BASE 7.5
void setup()
{
Serial.begin(115200);
while (!Serial);
}
void loop()
{
float x = 0.0, inc = 0.01, amp = 255.0 / (BASE - 1);
int y;
while (x >= 0 && x <= 1) {
y = (int)(amp * (pow(BASE, x) - 1) + 0.5);
Serial.println(y);
analogWrite(13, y);
x += inc;
if (x >= 1) {
x = 1;
inc = -inc;
} else if (x <= 0) {
x = 0;
inc = -inc;
}
delay(15);
}
}
but I'm afraid my point remains. It's just that a basic example doesn't work out of the box and that could be discouraging. It was, for me: "Why does this simple example not even work?" This issue could be low priority and there's a lot to do obviously, but worth mentioning anyway, I thought.