Skip to content
New issue

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

Help sketch #4313

Closed
folny opened this issue Feb 6, 2018 · 3 comments
Closed

Help sketch #4313

folny opened this issue Feb 6, 2018 · 3 comments

Comments

@folny
Copy link

folny commented Feb 6, 2018

Hello friends

Can anyone advise me how to edit this sketch to work with ESP8266 in advance thanks for your reply.

https://github.com/dc42/arduino/blob/master/MetalDetector/MetalDetector.ino

Problem is with this frequent code

ISR(TIMER1_OVF_vect)
{
++ticks;
uint8_t ctr = TCNT0;
int16_t val = (int16_t)(uint16_t)ADCH; // only need to read most significant 8 bits
if (ctr != ((lastctr + 1) & 7))
{
++misses;
}
lastctr = ctr;
int16_t *p = &bins[ctr & 3];
if (ctr < 4)
{
*p += (val);
if (*p > 15000) *p = 15000;
}
else
{
*p -= val;
if (*p < -15000) p = -15000;
}
if (ctr == 7)
{
++numSamples;
if (numSamples == numSamplesToAverage)
{
numSamples = 0;
if (!sampleReady) // if previous sample has been consumed
{
memcpy((void)averages, bins, sizeof(averages));
sampleReady = true;
}
memset(bins, 0, sizeof(bins));
}
}
}

@tonton81
Copy link

tonton81 commented Feb 7, 2018

you need to ask on the forums, not here

@folny
Copy link
Author

folny commented Feb 7, 2018

Ok thanks.

@devyte
Copy link
Collaborator

devyte commented Feb 7, 2018

Closing per issue POLICY doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants