I want to use one of the digital pins of arduino as an output, but i want it to oscillate at a given frequency
i used this code and it worked perfectly
Code:
for (int i = 0; i <10000;i++)
{
int pin = 1;
digitalWrite(Pin,HIGH);
digitalWrite(Pin,LOW);
}
read_ADC();
this code is in an infinite loop and the pin oscillates at a freq
but the problem is i want this pin to keep oscillating while i am executing the read_ADC function.
with my current code when the program executes the read_ADC function the loop is not working and i am not able to generate these osciallations.
Is there a way that both these process can run in parallel?
You could toogle the pins within a Timer interrupt vector, whereas A/D is read at the main loop() function. Anyway, a priori this could be not considered as a parallel processing.