ryansuchocki / microscheme

A Scheme subset for Atmel microcontrollers.
http://ryansuchocki.github.io/microscheme/
MIT License
300 stars 20 forks source link

Reading current time #44

Closed nico202 closed 1 year ago

nico202 commented 2 years ago

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

glv2 commented 2 years ago

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?

nico202 commented 2 years ago

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!

ryansuchocki commented 2 years ago

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