hi. I have made an thermistor temp reading that shos temp on a oled, it works great on arduino uno, only 5 wires in total, but then i bought an ESP32C3, and now it dosent work, i have been reading and asking people for days now, no one is good enough in esp to help
only thing i get on the display is: -273 blinking like hell...
here is my code: #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels
Please edit your post, select all code and and apply so-called code tags by clicking the <CODE/> button. Next save your post.
This makes it easier to read, easier to copy and the forum software will maintain the formatting.
thanks for reply, it worked on arduino uno? so shouldn't it work on esp?
When i change the sentence: uint32_t Vo = analogReadMillivolts(ThermistorPin);
I get error: Compilation error: 'analogReadMillivolts' was not declared in this scope; did you mean 'analogReadMilliVolts'?
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4096)
analogReadResolution(12);
}
void loop() {
// read the analog
int analogValue = analogRead(A0);
int analogVolts = analogReadMilliVolts(A0);
// print out the values you read:
Serial.printf("ADC analog value = %d\n",analogValue);
Serial.printf("ADC millivolts value = %d\n",analogVolts);
delay(500); // delay in between reads for clear read from serial
}
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <driver/adc.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
int ThermistorPin = 2;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4096)
analogReadResolution(12);
}
void loop() {
// read the analog
int analogValue = analogRead(0);
int analogVolts = analogReadMilliVolts(0);
// print out the values you read:
Serial.printf("ADC analog value = %d\n",analogValue);
Serial.printf("ADC millivolts value = %d\n",analogVolts);
delay(500); // delay in between reads for clear read from serial
}
So the analogReadMillivolts is working.
You must have made a typo when you first tried it.
So your original sketch with the modifications I suggested should compile and work
Try it again