Search found 811 matches

by davef
Wed Jan 19, 2022 10:18 pm
Forum: General Discussion and Questions
Topic: Read csv and cast str to int
Replies: 10
Views: 12501

Re: Read csv and cast str to int

I was going to ask earlier because I don't the reason ... why do you want to use repr?
by davef
Wed Jan 19, 2022 6:25 pm
Forum: General Discussion and Questions
Topic: Are file writes non blocking?
Replies: 7
Views: 11580

Re: Are file writes non blocking?

Even a print() statement before lightsleep() or deepsleep() needs a wait or you only get part of it.

Code: Select all

    print ('going to lightsleep() for the timer duration')
    utime.sleep(.5) #  so print() works
    machine.lightsleep(5 * 1000)
by davef
Wed Jan 19, 2022 3:40 am
Forum: General Discussion and Questions
Topic: Read csv and cast str to int
Replies: 10
Views: 12501

Re: Read csv and cast str to int

Does print (str(string from csv )) work?
by davef
Wed Jan 19, 2022 12:44 am
Forum: ESP32 boards
Topic: Problem using GPIO as interrupt [Solved]
Replies: 3
Views: 4809

Re: Problem using GPIO as interrupt

I put a 100nF to ground on the GPIO used as an interrupt pin and that got rid of the "touching with a finger problem". Bypassing the motor terminals as suggested in the link improved "the response to motor noise problem" significantly. I am happy.
by davef
Wed Jan 19, 2022 12:29 am
Forum: General Discussion and Questions
Topic: Read csv and cast str to int
Replies: 10
Views: 12501

Re: Read csv and cast str to int

I had to google repr https://www.geeksforgeeks.org/str-vs-repr-in-python/ as I didn't even know it existed.

Code: Select all

i = '45'
print(repr(int(i))) 
works for me.
v1.17 on the ESP32. Have I misunderstood?
by davef
Tue Jan 18, 2022 6:16 pm
Forum: General Discussion and Questions
Topic: Read csv and cast str to int
Replies: 10
Views: 12501

Re: Read csv and cast str to int

When I make up my .csv file for my datalogger app I have a comma at the end of each string. I must have copied an example somewhere.
by davef
Mon Jan 17, 2022 11:29 pm
Forum: ESP32 boards
Topic: Problem using GPIO as interrupt [Solved]
Replies: 3
Views: 4809

Re: Problem using GPIO as interrupt

All I have on pin14 is a header pin and a 10K resistor to 3V3. I read that GPIO14 can be used as a touch GPIO so tried one of the non-touch GPIO and got same behaviour. Unfortunately, the wires to the motor/switch are in a 4 wire cable and the switch wires are well-wrapped around the motor power wir...
by davef
Mon Jan 17, 2022 10:08 pm
Forum: ESP32 boards
Topic: Problem using GPIO as interrupt [Solved]
Replies: 3
Views: 4809

Problem using GPIO as interrupt [Solved]

In trying to debug a watering timer app I found that when the motor turned ON it generated interrupts before the the shaft switch even actuated. Then I found that either touching the GPIO pin or turning a transformer type power supply on and off, about 1 metre away, would also generate interrupts! T...
by davef
Mon Jan 17, 2022 9:26 pm
Forum: General Discussion and Questions
Topic: deepsleep at the wrong end
Replies: 4
Views: 5956

Re: deepsleep at the wrong end

The reason I moved from ESP8266 to ESP32. Are you running gc.collect() at points through your program. There are some commands: import micropython micropython.mem_info() # setting a threshold for gc.collect() gc.threshold(gc.mem_free()) // 4 + gc.mem_alloc() that are supposed to be useful. BTW, I am...
by davef
Mon Jan 17, 2022 6:37 pm
Forum: General Discussion and Questions
Topic: Very low int rounding error on Raspberry Pico
Replies: 4
Views: 7393

Re: Very low int rounding error on Raspberry Pico

Known problem. If you are not too concern about any benefit of rounding up or down then just use string formatting, ie:

Code: Select all

Battery_voltage = f'{Battery_voltage:.2f}'