legend:
Yi = Y new
Yi-1 = Y old
i want to make this in my arduino
my function Yi = Yi-1 +6
start y0 = 0
Y1 = Y0 +6 = 6
Y2 = Y1 +6 = 12
Y3 = Y2 +6 = 18
Y4 = Y3 +6 = 24
pelase help me to make this code, i want to make infinity iteration
i need (6, 12, 18, 24) show in my serial monitor
i’ve tried make this code but im fail
volatile double y = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
}
void loop() {
for (int i=1; i > 0; i++)
{
y[i] += y[i-1] + 6;
}
}