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?
Hi Torgeir,
Can you please confirm that you have external power (12V or 24V) connected?
Best Regards,
Loic
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.
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!
Keep Informed
About This Forum
This community is for professionals and enthusiasts of our products and services.
Read GuidelinesQuestion tools
Stats
Asked: 1/29/18, 7:59 PM |
Seen: 2799 times |
Last updated: 1/30/18, 11:58 PM |
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.