alexan_e
Administrator
Sorry, it still the same error
static uint8_t pulse_flag = 0;
is for AVR GCC isn't it?
- - - Updated - - -
Ahaa I found it, I must add:
#include <stdint.h>
and now it works.
Thank you very much alexan
I don't need to include #include <stdint.h> manually, just by using #include <avr/io.h> it gets included and should work (avr studio).
Anyway the alternative is to use unsigned char instead of uint8_t
- - - Updated - - -
Any comments/suggestions? Which part should I fix ?
it is not the pulse part of the code so it is probably the adc part.
What is the rate of ADC sampling?
If you get a new adc result while you are in the middle of the pulse then you may miss the pulse return to the default state.
suppose that the adc gives a x of 40 , when you reach 40 the pin is set to low , then you may get a new reading and x equals 30 , now when you reenter the interrupt x+1 is not 41 but 31 so the pulse never returns to the default state.