Search found 3 matches

by Pettefar
Sat May 15, 2021 12:51 pm
Forum: Raspberry Pi microcontroller boards
Topic: String To Float
Replies: 3
Views: 3175

Re: String To Float

Here's the section of code: BlinkStr = str(LED[-1]) BlinkStr = BlinkStr[6:] print(BlinkStr) #BlinkRate = float(BlinkStr) >>> %Run -c $EDITOR_CONTENT 0.15 If I uncomment the float line then I get an error: >>> %Run -c $EDITOR_CONTENT Traceback (most recent call last): File "<stdin>", line 88, in <mod...
by Pettefar
Fri May 14, 2021 8:43 pm
Forum: Raspberry Pi microcontroller boards
Topic: List Indexing
Replies: 2
Views: 1986

List Indexing

I made a four part list from a string.split operation.

When I try and access it it says that List[2] is an “index too large” error. I have to use List[-2] instead. Similarly with List[3] and List[-1]. Am I somehow missing something?

I am using Thonny on a RPi 4 to program my Pico.

Nick
Dublin
by Pettefar
Fri May 14, 2021 8:40 pm
Forum: Raspberry Pi microcontroller boards
Topic: String To Float
Replies: 3
Views: 3175

String To Float

Hi, is there a conversion function/method to convert a string, say “0.15” to a float?

Nick
Dublin