Let's back up. Have you, thus far, been successful in getting the LED to light up or blink, in any manner?
I am going to assume the answer is that is 'yes'. In that case, I think the problem is your understanding of the local variable 'i'. The variable is uninitialized, and its value resets every time you call your loop, because it's a local variable.
I am not familiar with the hardware/software platform you're working with, but you either need to be able to query the global time of the software, or you need some state that is outside of the loop function itself. The simplest way to do this is with a global variable, since I am assuming you cannot change how the loop function is called.
Also, use meaningful variable names. 'i' isn't really meaningful and should only be used in simple for loops as the
de facto standard iteration variable.
1 2 3 4 5 6 7 8 9 10
|
int delay_ms = 0; // global variable!
void loop() {
delay_ms += 1000;
digitalWrite (4, HIGH);
delay (delay_ms);
digitalWrite (4, LOW);
delay (delay_ms);
}
|
(Global variables are not usually recommended; in general, you should pass variables through functions/classes. But if you can't change the signature of this loop function, then that might not be feasible.)
PS: On terminology -- you don't call something a "void". You'd call it a "function" in general, or a "void function" if it's important to qualify that it doesn't return a value.