Smart Home Automation Forum
[Arduino IDE demo source code for KC868-E16S]--#04-KC868-E16S-ADC_IN - 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-E16S/E16P (https://www.kincony.com/forum/forumdisplay.php?fid=26)
+--- Thread: [Arduino IDE demo source code for KC868-E16S]--#04-KC868-E16S-ADC_IN (/showthread.php?tid=1926)



[Arduino IDE demo source code for KC868-E16S]--#04-KC868-E16S-ADC_IN - KinCony Support - 05-17-2022

[Arduino IDE demo source code for KC868-E16S]--#04-KC868-E16S-ADC_IN
   

Code:
/*www.kinocny.com */
/*KC868-E16S CODE OF ADC-IN*/

#include "Arduino.h"

#define ANALOG_A1   36
#define ANALOG_A2   35
#define ANALOG_A3   34
#define ANALOG_A4   39

void setup()
{
    Serial.begin(115200);
    delay(500);

  pinMode(ANALOG_A1,INPUT);
  pinMode(ANALOG_A2,INPUT);
  pinMode(ANALOG_A3,INPUT);
  pinMode(ANALOG_A4,INPUT);
}

void loop()
{

  if(analogRead(ANALOG_A1)!=0)  {Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A1,analogRead(ANALOG_A1));}
  if(analogRead(ANALOG_A2)!=0)  {Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A2,analogRead(ANALOG_A2));}
  if(analogRead(ANALOG_A3)!=0)  {Serial.printf("Current Reading A3 on Pin(%d)=%d\n",ANALOG_A3,analogRead(ANALOG_A3));}
  if(analogRead(ANALOG_A4)!=0)  {Serial.printf("Current Reading A4 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));}
  delay(50);
}