Search found 193 matches

by karfas
Wed Jul 20, 2022 8:14 pm
Forum: General Discussion and Questions
Topic: serial data reading with pico
Replies: 23
Views: 11481

Re: serial data reading with pico

today even the old code returns "none" so i think the connection may be bad Maybe you should check first if your signal really reaches the UART ? I usually have a few LEDs soldered to a 100 Ohm resistor in my toolbox. They are a very simple, very low-cost way to detect whether some signal arrives a...
by karfas
Wed Jul 13, 2022 2:41 pm
Forum: ESP32 boards
Topic: WLAN.connect with bssid?
Replies: 6
Views: 3892

Re: WLAN.connect with bssid?

Hey there, i want to prevent connecting to a network with the same name, so i'd like to use the bssid parameter, but it won't really let me sta_if.connect(ssid='myssid', password='mypass', bssid='5c:5c:5c:5c:5c:5c') It throws TypeError: extra keyword arguments given Router name and password are pos...
by karfas
Wed Jul 13, 2022 11:15 am
Forum: General Discussion and Questions
Topic: General Question
Replies: 16
Views: 7005

Re: General Question

I want to prevent the micropython code running on the controller from any attacker . This is my main goal . You are demanding the impossible. Any "security" scheme only increases the effort required to break in (and the expense to work with). I remember that even some security keys of otherwise ina...
by karfas
Sat Jul 09, 2022 6:54 pm
Forum: General Discussion and Questions
Topic: General Question
Replies: 16
Views: 7005

Re: General Question

Too much simplified, of course.
The MP_DEFINE.. macro creates the C representation of a micropython function object (name, C function address).
Then you add this object to one of the tables searched by the interpreter.
by karfas
Sat Jul 09, 2022 6:27 pm
Forum: General Discussion and Questions
Topic: General Question
Replies: 16
Views: 7005

Re: General Question

1) What happens... Much to broad question. Putty sends each typed character to the UART on the controller. There, the "firmware" (e.g. micropyhon's REPL) does something with it. Between putty and the UART may be: your computer's OS, a USB driver, a cable, a USB/serial chip on the controller and a my...
by karfas
Sat Jul 09, 2022 5:05 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 32138

Re: bits to bytes

the most efficient way to unpack it at the receiver? No, as this requires at least one memory allocation for the unneeded intermediary binary string. I have no idea why you should care about efficiency here. You transmit over LoRa with a latency of (how much ? 200, 300 ms ?) and can't sacrifice som...
by karfas
Sat Jul 09, 2022 5:53 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 32138

Re: bits to bytes

struct represents [1,1,1,1,0] as 0xf0 which is intuitive for me because it works in comfortable 4 bit nibbles. My problem with hex(int('11110') is that the 0x1e representation It doesn't halp that you come up with different interpretations of the same data. "11110" should be 0x1e, written in a stri...
by karfas
Fri Jul 08, 2022 1:05 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 32138

Re: bits to bytes

>>> struct.pack('<H', sum(int(bis)*(1<<(i^7)) for i, b in enumerate(bis))) b'\xf0\x00'[/code] For me, this is way too complicated. As you can get the integer representation of your bits for cheap via int(bis, 2) you are already fine to pack this. I don't see any value in looping through the string....
by karfas
Thu Jul 07, 2022 10:24 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 32138

Re: bits to bytes

r=chr(int(bys)) Creates a single byte. No. This might be the case in micropython (and would be a bug, I think). CPython(3) returns a (Unicode!) character. This might be a byte. See https://docs.python.org/3/library/functions.html#chr chr(i) Return the string representing a character whose Unicode c...
by karfas
Thu Jul 07, 2022 9:43 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 32138

Re: bits to bytes

I would assume that chr(something) will return ONE character. Found out that chr(something) might return an Unicode character (more than one byte). You can also use bit operations to split the large integer to real bytes, like in: >>> bis='1111011111111010' >>> d = int(bis, 2) >>> d >> 8 247 >>> (h...