Does NewPing support ATTiny13?

Issue #47 resolved
Vijay Sharma created an issue

Hi, Firstly thank you so such a great library but I am trying to get my HCSR04 sensor work ATTiny13? Does your library support this? I am able to compile the code for ATTiny85 but not for ATTiny13.

Errors I get are below: C:\My Documents\Circuits\Sketches\libraries\NewPing-1.9.1\src\NewPing.cpp: In static member function 'static void NewPing::timer_us(unsigned int, void (*)())': C:\My Documents\Circuits\Sketches\libraries\NewPing-1.9.1\src\NewPing.cpp:254:3: error: 'OCR2A' was not declared in this scope OCR2A = min((frequency>>2) - 1, 255); // Every count is 4uS, so divide by 4 (bitwise shift right 2) subtract one, then make sure we don't go over 255 limit.

Comments (4)

  1. Tim Eckel repo owner

    Change #define TIMER_ENABLED true to false in the NewPing.h file. This is designed for you to change as needed.

  2. Vijay Sharma reporter

    Great! , I did not notice that. I made the change and it works well now. Also, can you tell if disabling timers preserves the accuracy of results?

  3. Tim Eckel repo owner

    Has nothing to do with accuracy. It has to do with using the methods that use a timer, which isn't available on the Tiny as it doesn't have the timers needed.

  4. Log in to comment