XGO library
Issue #274
resolved
I'm trying to build a library for XGO(https://www.elecfreaks.com/learn-en/microbitKit/microbit-xgo-robot-kit/1.microbit-xgo-robot-kit-Introduction.html)
But I encounter a problem:
https://github.com/elecfreaks/pxt-xgo/blob/master/main.ts#L231
move_buffer[6] = ~(0x09 + 0x00 + 0x31 + move_buffer[5])
when I translate the code directly in microblocks, move_buffer[6]
will be treated a negative number in MicroBlocks , after that it cannot be written as a byte
Comments (3)
-
-
reporter Thanks for the tip, here's my solution, it works for me
-
reporter - changed status to resolved
- Log in to comment
It seems to be a kind of checksum from move_buffer[2 .. 5] clamped to a byte.
You may try simplified
move_buffer[6] = ~( ( 0x3A + move_buffer[5] ) mod 256)