05-12-2022, 07:20 AM
(This post was last modified: 05-12-2022, 07:50 AM by KinCony Support.)
[Arduino IDE demo source code for KC868-A64]--#03-ADC_code
Code:
/*www.kincony.com*/
/*KC868-A64 Code of ADC_INPUT */
#include "Arduino.h"
#define ANALOG_A1 39
#define ANALOG_A2 34
#define ANALOG_A3 36
#define ANALOG_A4 35
void setup()
{
Serial.begin(115200);
delay(1000);
pinMode(ANALOG_A1,INPUT);
pinMode(ANALOG_A2,INPUT);
pinMode(ANALOG_A3,INPUT);
pinMode(ANALOG_A4,INPUT);
}
void loop()
{
delay(500);
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));}
}