Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arduino UNO digital pin config

Status
Not open for further replies.

susane

Newbie level 6
Joined
Apr 12, 2016
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
128
Hi

I am using arduino uno

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?
 
Last edited by a moderator:

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.
 

can you please send me the code for this?
i am new to programming and i didnt understood what you said.
 

Hi,

read about "waveform generation" or "PWM generation" in the microcontroller´s datasheet.

Only a few bytes to setup, then it takes no further processing power.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top