We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unsigned long currentAcc = 0; unsigned int count = 0; unsigned long prevMicros = micros() - sampleInterval ; while (count < numSamples) { if (micros() - prevMicros >= sampleInterval) { int adc_raw = analogRead(currentPin) - adc_zero; currentAcc += (unsigned long)(adc_raw * adc_raw); ++count; prevMicros += sampleInterval; } }
float rms = sqrt((float)currentAcc/(float)numSamples) * (75.7576 / 1024.0); Serial.println(rms);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
unsigned long currentAcc = 0;
unsigned int count = 0;
unsigned long prevMicros = micros() - sampleInterval ;
while (count < numSamples)
{
if (micros() - prevMicros >= sampleInterval)
{
int adc_raw = analogRead(currentPin) - adc_zero;
currentAcc += (unsigned long)(adc_raw * adc_raw);
++count;
prevMicros += sampleInterval;
}
}
float rms = sqrt((float)currentAcc/(float)numSamples) * (75.7576 / 1024.0);
Serial.println(rms);
The text was updated successfully, but these errors were encountered: