zeroflag / punyforth

Forth inspired programming language for the ESP8266
Other
410 stars 43 forks source link

ADC command #17

Closed alport closed 7 years ago

alport commented 7 years ago

I am not seeing an ADC example. Is this command implemented?

zeroflag commented 7 years ago

Not implemented yet. I don't have any analog sensors. But if you're willing to test it, I can implement it.

alport commented 7 years ago

Thanks for the quick reply. I am certainly willing to test it but am traveling right now - back at my workbench in 2 weeks! A test voltage divider is easy to set up. Mike

On Sun, 29 Jan 2017 at 9:42 PM Attila Magyar notifications@github.com wrote:

Not implemented yet. I don't have any analog sensors. But if you're willing to test it, I can implement it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zeroflag/punyforth/issues/17#issuecomment-275906050, or mute the thread https://github.com/notifications/unsubscribe-auth/ACeCuPov1TV6OKZhfWzPEKKK1o0xuIuaks5rXG0fgaJpZM4LwwaB .

-- Dr Mike Alport (PhD Iowa) Managing Director Advanced Imaging Technologies (Pty) Ltd Unit 20, 8 Reed Place, Maxmead, Pinetown, 3610, South Africa. PO Box 906, Westville, 3630, South Africa. Ph: +27 (0)31 701-7078 Fax:+27 (0)86 510-2225 Cell:+27 (0)82 555-1747 Email: alport@ait-sa.com URL: www.AIT-SA.com Skype: mike.alport

zeroflag commented 7 years ago

I added the adc-read ( -- n ) word. This is based on the function uint16_t sdk_system_adc_read(void) from esp-open-rtos.

https://github.com/SuperHouse/esp-open-rtos/blob/0dadda86decd191e4b2ad1184b790fd33175674e/include/espressif/esp_system.h#L78

Measure voltage on the TOUT pin, 1V max. Returns 10 bits ADC value (1/1024V). Voltage range 0 .. 1.0V. RF must be enabled.

Please let me know if it doesn't work as intended.