Search found 5 matches

by Maximilianus
Fri Oct 22, 2021 11:39 am
Forum: Raspberry Pi microcontroller boards
Topic: Simple program crash
Replies: 8
Views: 3107

Re: Simple program crash

This one works......Thanks!

Code: Select all

import machine, utime, gc

LED = machine.Pin(15, machine.Pin.OUT)
potentiometer = machine.ADC(27)


while True:
    LED.toggle()
    utime.sleep_ms((potentiometer.read_u16() // 100))
    print(gc.mem_free())
    print(potentiometer.read_u16()//100)
by Maximilianus
Fri Oct 22, 2021 9:20 am
Forum: Raspberry Pi microcontroller boards
Topic: Simple program crash
Replies: 8
Views: 3107

Re: Simple program crash

Sorry. It does not work like that. I need numbers between 0 and 1. The numbers are generated by the ADC input and a mutiplication factor. With the // it will be 0 or 1 and nothing inbetween. So what I am testing is ADC input and convert it to the flash frequency of an LED. utime.sleep(0.08) will wor...
by Maximilianus
Fri Oct 22, 2021 8:32 am
Forum: Raspberry Pi microcontroller boards
Topic: Simple program crash
Replies: 8
Views: 3107

Re: Simple program crash

Thanks for your answer. But it does not make sense to me.

I can use the line: Pauze = 2 * 3
No crash.

But I can't use the line: Pauze = 0.5 * 6
Crash.

In both cases I don't even use the variabele Pauze. It's just a line of code.

This does not seem logic to me.

How can I work around this?
by Maximilianus
Thu Oct 21, 2021 4:40 am
Forum: Raspberry Pi microcontroller boards
Topic: Simple program crash
Replies: 8
Views: 3107

Re: Simple program crash

Thank you. Looks better like that! So this line makes it crash after running some time and filling up memory: Pauze = potentiometer.read_u16() * potentiometer.read_u16() * 0.08 If I remove the * 0.08 it doesn't crash. Why can that be? It is actual the decimal number that fills up memory while runnin...
by Maximilianus
Wed Oct 20, 2021 7:31 pm
Forum: Raspberry Pi microcontroller boards
Topic: Simple program crash
Replies: 8
Views: 3107

Simple program crash

Hello, I run a simple program on the Pico that crashes after several minutes. Printing the memory showed that the free memory is reduced. Until it crashes. I removed as many lines as possible and found that the multiplying factor (* 0.08) reduces free memory. How can I solve this? Thanks. import mac...