Search found 16 matches

by BL007
Wed Nov 11, 2020 4:56 pm
Forum: Programs, Libraries and Tools
Topic: pin-init in main; no knows in subroutines?
Replies: 1
Views: 1656

pin-init in main; no knows in subroutines?

Hello, I've in the main progamm a pin initialized as output and it works. Then I did make subroutines and put this in another files for a better overview. The file I integrated wirth import. The Call of the subroutines takes place after the pin initialization. But MicroPython shows me an error than ...
by BL007
Fri Nov 06, 2020 10:33 am
Forum: Programs, Libraries and Tools
Topic: a problem with thonny or µPython???
Replies: 3
Views: 2566

Re: a problem with thonny or µPython???

Thank you very mutch!
If you are in Thuringia the next time, I owe you:
by BL007
Wed Nov 04, 2020 6:44 pm
Forum: Programs, Libraries and Tools
Topic: a problem with thonny or µPython???
Replies: 3
Views: 2566

a problem with thonny or µPython???

Hello, I want open a file. This file is r.a.120kB. Because I have a ESP with 8/4MB SPI-RAM. I open the file, read it with readlines(), determinate the numbers of lines and show that in the shell. SC1 All in butter. Maby a half minutes later the completly content of the variabe lines/file appears in ...
by BL007
Tue Nov 03, 2020 9:21 am
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

Re: hexadecimal numbers over UART

Roberthh wrote:
Tue Nov 03, 2020 9:11 am
You tried hexlify instead of unhexlify.
OK, this works too.
I can't read. Sorry!
by BL007
Tue Nov 03, 2020 9:15 am
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

Re: hexadecimal numbers over UART

I wrote a function. This works. def str2byte16(strdata): from struct import pack num8 = str2byte8(strdata[0]) num16 = str2byte8(strdata[1]) data16 = (num16 * 16) + num8 bytedata16 = pack('B',data16) return bytedata16 def str2byte8(strdata): numchar = ord(strdata[0]) if numchar > 47 and numchar < 58:...
by BL007
Tue Nov 03, 2020 8:01 am
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

Re: hexadecimal numbers over UART

Thanks!

But that's not it.

This makes the ASCII-Code of the letters. From 'EE' => 4545
I need b'\xee'.
by BL007
Mon Nov 02, 2020 6:15 pm
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

Re: hexadecimal numbers over UART

uart.write(b'\xAA') >>> 0x41 0x41 That was wrong from me. I recieve the dates from the UART in a PIC. There I forgot that I need a b'\x01' before the actual data. If I send uart.write(b'\x01\xAA) then I recieved 0xAA in the PIC. That's all good and chic. But it's not the solution of my problem. I h...
by BL007
Sun Nov 01, 2020 9:44 am
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

Re: hexadecimal numbers over UART

Thanks!
The conversion from str to hex is clear. It works with de-/encode() also.

But the UART.write() sends ASCII only.

uart.write(b'\xAA')
>>> 0x41
0x41

If I want send 238 as an integer, the µPython brings error. The question ist, can the UART class works with strings only?
by BL007
Thu Oct 29, 2020 9:40 am
Forum: ESP32 boards
Topic: Upload file of 250kB or more
Replies: 10
Views: 6409

Re: Upload file of 250kB or more

Thanks for the help! I've no objection to Robert's FTP solution. But, who should be used my control unit with the software that I've to make, somtimes has no idee about computer. The ESP-Unit should is supposed a connection beetwen a controlller unit an a smartphone/tablet/PC. For this is the first ...
by BL007
Tue Oct 27, 2020 4:59 pm
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 9353

hexadecimal numbers over UART

Hello,


how can I send hexadecimal numbers via UART?
If I try 'hex(0xEE)' then I get an error from µPython. '238' also. 'bytes([283])' or 'bytes([0xEE)' sends a 0x00.

I use the UART lib from µPython.