Smart Home Automation Forum
[Arduino demo source code for KC868-A4]-05 read analog input (ADC) data - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A4 (https://www.kincony.com/forum/forumdisplay.php?fid=21)
+--- Thread: [Arduino demo source code for KC868-A4]-05 read analog input (ADC) data (/showthread.php?tid=1644)



[Arduino demo source code for KC868-A4]-05 read analog input (ADC) data - KinCony Support - 01-07-2022

Code 4: //The demo code is ADC INPUT    You can copy the code to your Arduino IDE

Code:
#define ANALOG_PIN_32   32      //INA1  CH5

// #define ANALOG_PIN_33   33   //INA2  CH4
// #define ANALOG_PIN_34   34   //INA3  CH6
// #define ANALOG_PIN_35   35   //INA4  CH7


void setup(){
  Serial.begin(115200);
  pinMode(ANALOG_PIN_32,INPUT);
}

void loop() {
  int analog_value = 0;
  analog_value = analogRead(ANALOG_PIN_32);   //0--4096
  delay(1000);
  Serial.printf("Current Reading on Pin(%d)=%d\n",ANALOG_PIN_32,analog_value);
}