So it appears to be printing numbers reliably - they're just not the right ones. Is that code really exactly what you have? You're not doing something to the array inbetween?
What happens if you change jsiConsolePrintf("%d,", in[i]); to jsiConsolePrintf("%d,", (int)in[i]); (and so on for the others).
As I said above, trying to print as a string - with jsiConsolePrint (or %s) is just really bad news. You're basically printing the contents of memory starting from the address with the same number as your character - hence why you're getting garbage like ,,,,,,%,,,M. That kind of thing can usually totally crash the chip as well as printing garbage :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
123,35,72,75
{#HK
{,#,R,K,
So it appears to be printing numbers reliably - they're just not the right ones. Is that code really exactly what you have? You're not doing something to the array inbetween?
What happens if you change
jsiConsolePrintf("%d,", in[i]);
tojsiConsolePrintf("%d,", (int)in[i]);
(and so on for the others).As I said above, trying to print as a string - with
jsiConsolePrint
(or%s
) is just really bad news. You're basically printing the contents of memory starting from the address with the same number as your character - hence why you're getting garbage like,,,,,,%,,,M
. That kind of thing can usually totally crash the chip as well as printing garbage :)