Problems with analogRead

My IND.I/O D21G is unable to read analog values.
When I try to analogRead it freece.

void setup() {
...
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin();  

...

  Indio.setADCResolution(12);
  Indio.analogReadMode(1, V5_p);
}

void loop() {
...
float fltPressure1=1;
fltPressure1=Indio.analogRead(1);   //Read Analog-In CH1

 lcd.setCursor(0,2);
 lcd.print("Pressure: ");  
 lcd.print(fltPressure1);
 lcd.print("    ");

}

If I comment out fltPressure1=Indio.... the LCD shows: Pressure: 1

What can possibly be wrong here?

Torgeir Ekeland
Torgeir Ekeland
7
| 2 1 2
Asked on 1/29/18, 7:59 PM
0
vote
2799 Views

Hi Torgeir, to add to Loic's suggestion, please do not use the V5 mode but the V10 standard instead, it should give you enough resolution in the 0-5V range.

Tom
on 1/30/18, 11:58 PM

Hi Torgeir,

Can you please confirm that you have external power (12V or 24V) connected?

Best Regards,

Loic

Loic De Buck
Loic De Buck
1263
| 3 1 3
Answered on 1/30/18, 6:34 AM
1
vote

Yes and no, I had 24v connected, but the display showed only random pixels. The 24v was thus disconnected, but is now reconnected and now it works. Thanks.

Torgeir Ekeland
on 1/31/18, 5:27 PM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

42 follower(s)

Stats

Asked: 1/29/18, 7:59 PM
Seen: 2799 times
Last updated: 1/30/18, 11:58 PM