现在还是用RC RL 电压变化关系 在这里都是令t=τ 百度资料
XXXXXXXXXXXXXXXXXXXXXX/view/XXXXXXXXXXXXXXXXXXXXXXXXXXXml 测量电感
这个速度跟不上 测大电感可以 (几亨利)
int WaveOutPin=12;
int MeasureInPin=A0;
long a,b,c;
float k,Calibration,L,R;
float hi;
void setup(){
XXXXXXXXXgin(9600); pinMode(WaveOutPin,OUTPUT);
digitalWrite(WaveOutPin,LOW);
k=exp(-1);
R=100;
c=100;
hi=1023;
delay(5);
}
void loop(){
digitalWrite(WaveOutPin,HIGH);
a=micros();
Calibration=hi*k;
while(1==1){
if (analogRead(MeasureInPin)<=Calibration) {
b=micros();
break;
}
}
digitalWrite(WaveOutPin,LOW);
delay(100);
L=((b-a-c))*R;
XXXXXXXXXintln(L);}
ps 上面代码还没测试