Smart Home Automation Forum

Full Version: [Arduino demo source code for KC868-A4]-05 read analog input (ADC) data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);
}
[attachment=549]