microscheme icon indicating copy to clipboard operation
microscheme copied to clipboard

Reading current time

Open nico202 opened this issue 3 years ago • 3 comments

Hi, I'm checking out this project and I really like it. I wanted to re-write the DHT (temeprature sensor) library in it, but I could not find a way to get the current time (something like the micros() or millis() functions).

Is there a way right now?

Thanks

nico202 avatar Nov 11 '21 16:11 nico202

Currently keeping track of time is not implemented. However it is possible to implement the DHT protocol without it. I did it for the DHT11 sensor in https://github.com/glv2/microscheme/tree/dht (tested with an Arduino Nano).

@ryansuchocki where do you think the implementation of generic protocols (TWI/I2C, SPI, etc) or custom protocols (DHT, sensors, etc) should go? In "src/stdlib.ms", in the "examples" directory, in a "libraries" directory, or in another repository?

glv2 avatar Nov 11 '21 20:11 glv2

However it is possible to implement the DHT protocol without it.

Yes I realized it after asking the question, but I still need time to measure the temperature change over time for my project.

I did it for the DHT11 sensor in https://github.com/glv2/microscheme/tree/dht (tested with an Arduino Nano).

Thanks, I'll try to make it work with the DHT21 and eventually open a PR!

nico202 avatar Nov 12 '21 10:11 nico202

Implementations of generic and specific protocols should go in the top level "libraries" directory which I've just created. Thanks.

ryansuchocki avatar Nov 12 '21 10:11 ryansuchocki