Pages: 1 [2]   Go Down
Author Topic: Does AnalogRead() use any timer ?  (Read 1968 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i tried as you suggested

Oh? Post the code where you tried.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Below is the code i tried

Code:


int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider

void pinChange()
{

fsrReading = analogRead(fsrPin);
   
}

    void setup(void) {
       
       Serial.begin(9600); // We'll send debugging information via the Serial monitor
attachInterrupt (0, pinChange, CHANGE);  // attach interrupt handler
    }

    void loop(void) {

    Serial.print("Analog reading = ");
    Serial.println(fsrReading);
 
  }



In the above code, i don get any values from ISR.
Thanks
Anand
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Below is the code i tried
Apparently, you didn't do as Nick suggested. That code looks nothing like the example on his site.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Below is the code i tried
...
In the above code, i don get any values from ISR.
Thanks

Thanks for what? You have totally ignored my suggested code.

I didn't say "attach an interrupt and everything will be solved". I posted code for starting an ADC conversion without waiting, using an interrupt to detect when that finished, and getting the converted value.
Logged

Pages: 1 [2]   Go Up
Jump to: