#include "my_arduino_lib_v1_5.h"
#define FND_595_IF 1
#include "My_Arduino_FND_Lib_V2_3.h"
int Low_ad_data =0;
int Low_ad_cds = 0;
float ad_buf = 0.0;
int volt;
char d_buf[40];
int adc_AVG_read(char ch, char loop)
{
unsigned int buf = 0;
char k;
for(k = 1; k <= loop; k++)
{
buf += analogRead(ch);
}
return (buf/loop);
}
void setup() {
// put your setup code here, to run once:
pinMode(A0, INPUT);
DDRD = DDRB = 0xff;
pinMode(A1, INPUT);
Serial.begin(115200);
Seg_V -> Dp_595_Digit = 1;
}
void loop() {
// put your main code here, to run repeatedly:
//Low_ad_data = adc_AVG_read(A0, 20); // 평균
Low_ad_cds = adc_AVG_read(A1, 20); // 평균
//Low_ad_data = analogRead(A0); // No 평균
//ad_buf = (Low_ad_data * (5/1024));
//ad_buf = (Low_ad_data * 0.0048875855);
//volt = (int)ad_buf * 1000;
volt = (int)((Low_ad_data * 0.0048875855) *1000);
sprintf(d_buf, "Low Data = %d, Volt = %d\r\n", Low_ad_data, volt);
Serial.println(d_buf);
fnd_595_out(volt);
// delay(100);
}