I use AB-01 boards ver 1.2
I need to check light level so I read photoresistor data.
Circuit is standard, like on the picture:
just one modification - I put power to photoresistor from GPIO pin - I suppose there is 3.3v.
All the rest the same - 10K resistor and ADC pin.
I use a lot this circuit with another device - Moteino - I also power photoresitor from GPIO 3.3v - and I receive from photoresistor data via analogRead() function - the values around 750 in my test conditions.
I noticed that on AB-01 boards ver 1.2 when you read ADC with connected photoresistor in this standard circuit - it shows data which much differ - values around 3500.
So again - same circuit, same components, just different device - and analogRead function show different data.
code pretty simple:
#include "LoRaWan_APP.h"
// light sensor >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//HTCC-AB01
//https://github.com/HelTecAutomation/CubeCell-Arduino/blob/master/variants/CubeCell-Board/pins_arduino.h
#define LIGHT_PWR P0_2 // GPIO0
#define LIGHT P2_3 // ADC
// light sensor <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void setup()
{
Serial.begin(9600);
pinMode(LIGHT_PWR, OUTPUT);
digitalWrite(LIGHT_PWR, LOW);
pinMode(LIGHT, INPUT);
}
void loop() {
digitalWrite(LIGHT_PWR, HIGH);
int light = analogRead(LIGHT);
Serial.print(F("light: ")); Serial.println(light);
digitalWrite(LIGHT_PWR, LOW);
delay(2000);
}
and I can see in output:
light: 3438
light: 3371
light: 3584
light: 3559
light: 3753
light: 3521
is it normal behavior and I should just consider to take this in mind and correct my code for CubeCells boards? or Im doing something wrong while reading analog values from ADC pin this way?