ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer How-Tos & Tutorials

PulseIn and Time with Arduino

Updated on August 25, 2017

pulseIn

When we use this programming command, we can measure the time interval of an event in microseconds. In the example I use in my video, each time we press a high or a logical state on pin 7, then the time count starts and ends until the state is low or zero. This tool I have seen that is used in ultrasound sensors to do the distance conversions in relation to time, however I have noticed that it has errors when used to measure long time intervals, for example ten seconds or more .

Then we can see a photograph of this circuit with a button connected to pin7, also the video is shown below.

Using pulseIn
Using pulseIn

Time

Now I show you how to measure time with the library time. With this library the conversions are automatic and you can configure: hour, minutes, seconds, day, month and year without any problem. I have used it in complex systems and I have not had any problem of error in the measurements of the time.


Below, I show you a picture of this project. In the video shown above we can observe two examples, in the first we see how it works correctly when we print the date and time in the serial port, in the second example we can see how a time alarm is programmed.

Using Time
Using Time

© 2017 Guillermo Perez Guillen

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.