using FreqCount Library with Arduino Lilypad USB Board

Status
Not open for further replies.

olivier

New member
Hi there,
thank you so much for creating the Frequency Count library.
I would like to use it with a "Arduino Lilypad USB" board.
Which pin should I use to read the frequency?

Many thanks,
Olivier
 
I don't know.

You'll need to look at the schematic for Uno and figure out which AVR pin it is. Then find that pin on the AVR chip on Lilypad, and figure out which outside pin it goes to. Or if it doesn't go to any pin on the outside, you'll have to connect to it directly at the chip.
 
Hi Paul, thanks for your quick answer.

I am facing another problem when I am using any board with a ATmega32u4 (leonardo or lilypad usb). The example code for the FreqCount library won't compile.
Here is the code (from the library example folder):

#include <FreqCount.h>

void setup() {
Serial.begin(57600);
FreqCount.begin(1000);
}

void loop() {
if (FreqCount.available()) {
unsigned long count = FreqCount.read();
Serial.println(count);
}
}


And here is what I get from the complier:


In file included from C:\Users\User\Documents\Arduino\libraries\FreqCount\FreqCount.cpp:27:0:
C:\Users\User\Documents\Arduino\libraries\FreqCount\util/FreqCountTimers.h: In function 'void timer_shutdown()':
C:\Users\User\Documents\Arduino\libraries\FreqCount\util/FreqCountTimers.h:556:2: error: 'TCCR2B' was not declared in this scope
TCCR2B = 0;
^
Error compiling.


Do you know how it could be fixed?
 
I tried it just now, on Arduino 1.6.0 with Teensyduino 1.21-beta5. I just put a copy of FreqCount into hardware/arduino/avr/libraries.

I could not reproduce the problem. As you can see in this screenshot, the code you posted compiles without any error.

sc.png
 
Thanks Paul,
it is working with the new version!
I also found that the pin PB6 is the one I need on the ATmega32u4. Unfortunately this pin is not connected on the LilyPad USB board...
 
Status
Not open for further replies.
Back
Top