Giter VIP home page Giter VIP logo

elapsedmillis's People

Contributors

ivankravets avatar pfeerick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elapsedmillis's Issues

Add installation info and elapsedSeconds to doc

The main link for documentation for elapsedMillis seems to be https://github.com/pfeerick/elapsedMillis/wiki but it doesn't document the elapsedSeconds code available in the library.

There is advice for installation on https://www.arduino.cc/reference/en/libraries/elapsedmillis/ to:

To use this library, open the Library Manager in the Arduino IDE and install it from there.

Please add that installation line to the wiki.

The elapsedSeconds class is documented in the example and code: https://github.com/pfeerick/elapsedMillis/blob/master/examples/blinkingLeds/blinkingLeds.ino

class elapsedSeconds

Please add "elapsedSeconds" to the first header in https://github.com/pfeerick/elapsedMillis/wiki

Edit README.md to show:

The elapsedMillis, elapsedMicros, and elapsedSeconds special variable types (objects) automatically increase as time elapses. This makes it easy to check if a certain time has elapsed, while allowing your program to perform other work or checks for user input. It is also very to handle multiple tasks requiring different delays.

Library not functioning on Intel Edison

Curiously, the library does not appear to be functioning on the Intel Edison.

This is a sample code. Does not print to the serial monitor. If I comment out the timer however, it prints just fine.

Any thoughts why this may be the case? I am perplexed.

include <elapsedMillis.h>

elapsedMillis stimer0; // global timer
void setup() {

}

void loop() {
// put your main code here, to run repeatedly:
Serial.println("Waiting...");
while (stimer0 < 1000)
{
//do nothing, just pause
}

}

Long delays are not working

Good Morning,

I am using an Arduous Mega 2560 board to create a heat staging time delay. The code works fine for short time periods, but delays longer than about 30 seconds make the delay stop working.

I am guessing is that the data type is an int, which only goes up to 32,767 on the Mega. If this is correct, it may be helpful to add this caution the wiki document, or update the data type to unsigned long.

Thank you!

Move all files to the root Don't have an extra folder

Kindly move all the files to the root and remove the extra folder.

Most people (including me) just do a git clone in the libraries folder and having an extra library folder messes things.

While you are at it, it will also be really nice if you can change the repo name to just elapsedMills. Github provides automatic redirect so I guess it shouldn't be an issue.

PS: I can submit a pull request if needed.

elapsedSeconds has unnecessary float math

The elapsedSeconds class uses millis()*0.001 several times, which requires conversion to float and then back to unsigned long. I changed the expression to millis()/1000, which preserves integer math, and the class works as intended.

Also, elapsedSeconds needs to be added to the Keywords file.

value of elapsedMillis object not an unsigned long?

I am having problems printing elapsedMillis object values to the serial port in Arduino avr code, and it appears that this is caused by the object not returning an unsigned long value. The following is a small program to illustrate the problem:

/*
    Name:       PrintEx_ElapsedMillis.ino
    Created:	8/14/2020 9:47:31 AM
    Author:     FRANKNEWXPS15\Frank
*/

#include <elapsedMillis.h>
#include <print.h> //allows printf-style printout syntax

elapsedMillis sinceLastCheckMsec = 0;

void setup()
{
  Serial.begin(115200);
  sinceLastCheckMsec = 0;

  Serial.printf("small program to demonstrate problems with modified Print.h\n");
  Serial.printf("Printing out value of an 'elapsedMillis' object sinceLastCheckMsec, with & without chaining\n");
  Serial.printf("Printing out return value from millis(), with & without chaining\n");
  Serial.println();

  Serial.printf("sinceLastCheckMsec no chaining, no cast: %lu\n", sinceLastCheckMsec);

  Serial.printf("sinceLastCheckMsec no chaining, cast to (unsigned long): %lu\n", (unsigned long)sinceLastCheckMsec);

  Serial.printf("chaining: millis = %lu\tsinceLastCheckMsec (cast to unsigned long): %lu\n", millis(), (unsigned long)sinceLastCheckMsec);

  Serial.printf("chaining: millis: %lu\tsinceLastCheckMsec (no cast): %lu\tsinceLastCheckMsec (cast to unsigned long): %lu\tsinceLastCheckMsec (cast to uint32_t): %lu\n",
    millis(), sinceLastCheckMsec, (unsigned long)sinceLastCheckMsec, (uint32_t)sinceLastCheckMsec);

  Serial.printf("chaining: millis: %lu\tsinceLastCheckMsec (cast to unsigned long): %lu\tsinceLastCheckMsec (no cast): %lu\tsinceLastCheckMsec (cast to uint32_t): %lu\n",
    millis(), (unsigned long)sinceLastCheckMsec, sinceLastCheckMsec, (uint32_t)sinceLastCheckMsec);

  Serial.printf("ms: %lu\tChk: %lu\tChk:: %lu\tChk: %lu\n",
    millis(), (unsigned long)sinceLastCheckMsec, sinceLastCheckMsec, (uint32_t)sinceLastCheckMsec);

  Serial.printf("chaining: millis: %lu\tsinceLastCheckMsec (cast to unsigned long): %lu\tmillis: %lu\tsinceLastCheckMsec (cast to unsigned long): %lu\n",
    millis(), (unsigned long)sinceLastCheckMsec, millis(), (unsigned long)sinceLastCheckMsec);
}

void loop()
{
}

When this is run on an Arduino Mega, I get the following output:

Opening port
Port open
small program to demonstrate problems with modified Print.h
Printing out value of an 'elapsedMillis' object sinceLastCheckMsec, with & without chaining
Printing out return value from millis(), with & without chaining

sinceLastCheckMsec no chaining, no cast: 92217847
sinceLastCheckMsec no chaining, cast to (unsigned long): 17
chaining: millis = 22	sinceLastCheckMsec (cast to unsigned long): 22
chaining: millis: 28	sinceLastCheckMsec (no cast): 1843703	sinceLastCheckMsec (cast to unsigned long): 1835008	sinceLastCheckMsec (cast to uint32_t): 0
chaining: millis: 41	sinceLastCheckMsec (cast to unsigned long): 41	sinceLastCheckMsec (no cast): 2695671	sinceLastCheckMsec (cast to uint32_t): 92209152
ms: 55	Chk: 55	Chk:: 3613175	Chk: 0
chaining: millis: 58	sinceLastCheckMsec (cast to unsigned long): 58	millis: 58	sinceLastCheckMsec (cast to unsigned long): 58

I looked at the ellapsedMillis code, but I can't for the life of me see why a reference to an elapsedMillis object doesnt return an 'unsigned long' object, but I'm pretty sure that's what is happening. I use elapsedMillis objects a lot, and it would be nice if I didn't have to remember to always explicitely cast references to 'unsigned long'.

TIA

Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.