void setup(){
analogWrite(10, 38); //Output 0.6V(Duty cycle:15%) from D10
delay(10);
analogReference(EXTERNAL); //Set peak voltage of analog input
Serial.begin(115200); //Start serial connection
Serial.println("Setups are done. It will start to measure."); //Boot message
analogWrite(9, 38); //Constant Current output start
}
void loop(){
float volt = analogRead(A0) * 0.6 / 1023; //Read voltage and save on "volt"
//V=RI ⇔ R=1000V(CRD : 1mA)
float ohm = volt * 1000; //Calculate resistance
Serial.print("Resistance : ");
Serial.print(ohm);
Serial.println("Ω");
}