Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A16]--#04-ADC INPUT
#1
Rainbow 
Code 3: //The demo code is ADC INPUT    You can copy the code to your Arduino IDE

Code:
#include "Arduino.h"

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

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);
  Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A1,analogRead(ANALOG_A1));
  Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A2,analogRead(ANALOG_A2));
  Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A3,analogRead(ANALOG_A3));
  Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));
}
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)