frequency and period measurement for arduino