Search found 211 matches
- Fri Mar 04, 2022 10:33 pm
- Forum: ESP32 boards
- Topic: ESP32 analogRead attenuation and accuracy
- Replies: 7
- Views: 26219
Re: ESP32 analogRead attenuation and accuracy
So this ADC.read_uv(), it doesn't exist in 1.17 firmware. I tried 1.18. It's not there either. i wonder if this is just an issue with the document maybe copy-pasted from pyboard. The call class ADC(pin, *, atten) also doesn't work. It only takes 1 parameter. So under the current scenario, is there ...
- Mon Feb 21, 2022 8:19 pm
- Forum: ESP32 boards
- Topic: ESP32 analogRead attenuation and accuracy
- Replies: 7
- Views: 26219
Re: ESP32 analogRead attenuation and accuracy
I've wound up the voltage at the analog inputs of several ESP32s set to ATTN_11DB over the years. I found the max 4095 count is reached at around 3.13v on my Fluke87. So maybe the high and low ends of the voltage range doesn't go linear enough. What about the mid section like say 2V? Is 2V represen...
- Mon Feb 21, 2022 4:00 am
- Forum: ESP32 boards
- Topic: ESP32 analogRead attenuation and accuracy
- Replies: 7
- Views: 26219
ESP32 analogRead attenuation and accuracy
I read from here that there are several attenuation levels of the ADC: https://docs.micropython.org/en/latest/esp32/quickref.html#adc-analog-to-digital-conversion On the other hand, random nerd tutorials has a different set of ranges with the same attenuation levels: https://randomnerdtutorials.com/...
- Sun Dec 26, 2021 6:12 pm
- Forum: ESP32 boards
- Topic: Adjusting timeout of UART after creating the object?
- Replies: 4
- Views: 8525
Re: Adjusting timeout of UART after creating the object?
Thanks. I could just call machine.UART() again? There's no indication it would work or what would happen if it gets called again. So I did some experimentation with calling it and sending and receiving data and with gc. It seems to work fine as long as I call gc.collect() to release memory from the ...
- Fri Dec 24, 2021 11:50 pm
- Forum: ESP32 boards
- Topic: Adjusting timeout of UART after creating the object?
- Replies: 4
- Views: 8525
Adjusting timeout of UART after creating the object?
I wish to adjust the timeout of an UART port I instantiated. I can't find anything in the reference:
https://docs.micropython.org/en/latest/ ... .UART.html
I can't just assign value to UART.timeout. That is not a member variable. So is there any way to make changes to the timeout? Thanks.
https://docs.micropython.org/en/latest/ ... .UART.html
I can't just assign value to UART.timeout. That is not a member variable. So is there any way to make changes to the timeout? Thanks.
- Sun Dec 05, 2021 8:00 pm
- Forum: General Discussion and Questions
- Topic: Can't make static local variable work
- Replies: 1
- Views: 3532
Can't make static local variable work
I have this simple test code that runs on PC Python just fine but produces error on MP: def test_local(): if not hasattr(test_local, "myVar"): test_local.myVar = 10 print(test_local.myVar) On PC: >>> test_local() 10 On MP (ESP32 port 1.17): >>> test_local() Traceback (most recent call last): File "<...
- Thu Dec 02, 2021 2:38 am
- Forum: ESP32 boards
- Topic: Questions about ntptime
- Replies: 9
- Views: 4785
Re: Questions about ntptime
Right thanks. I really don't need the module, just the offset.
- Thu Dec 02, 2021 12:16 am
- Forum: ESP32 boards
- Topic: Questions about ntptime
- Replies: 9
- Views: 4785
Re: Questions about ntptime
Thanks! I didn't know about the calendar module. It's not built-in, or in the stdlib or ecosys. Is it a 3rd-party contributed module for Python or MP? calendar comes with CPython. You can find the documentation here: https://docs.python.org/3/library/calendar.html The documentation for the time mod...
- Wed Dec 01, 2021 11:56 pm
- Forum: ESP32 boards
- Topic: Questions about ntptime
- Replies: 9
- Views: 4785
Re: Questions about ntptime
Thanks @davef!
I'll see if I can understand your code and incorporate into my script.
Curious, are those exception handling in import supposed to make your script run on both MP and Python (or another platform)?
I'll see if I can understand your code and incorporate into my script.
Curious, are those exception handling in import supposed to make your script run on both MP and Python (or another platform)?
- Wed Dec 01, 2021 11:54 pm
- Forum: ESP32 boards
- Topic: Questions about ntptime
- Replies: 9
- Views: 4785
Re: Questions about ntptime
The difference between the Micropython 2000 epoch and the unix 1970 is a constant. You can calculate that constant in CPython by using: import calendar epoch_1970 = (1970, 1, 1, 0, 0, 0, 0, 0) epoch_2000 = (2000, 1, 1, 0, 0, 0, 0, 0) time_offset = calendar.timegm(epoch_2000) - calendar.timegm(epoch...