.toString(radix) ? #1262
Replies: 7 comments
-
Posted at 2018-12-31 by @allObjects Assuming Reference doc http://www.espruino.com/Reference#l_Array_toString says:
Referred-to detail reference on MDN - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString - does not have any parameter for ...on the other hand it make perfect sense: You apply .toString() to the array object and not to the individual items in the array. If you do ��so, it just works. Did some messing around in the browser debugger console - you get there by ctrl-click and inspect, where you can enter JavaScript expressions when not being connected to an Espruino board:
Use Just validated in Espruino (on an Espruino-Wifi w/ Espruino 2v00). What though is clear is that the array elements have to be numbers / bytes, and NOT Strings or Chars.
BUT THEREFORE , we have to get a byte array from the string. This is the final answer:
...and with variable
This is for hex... the others are similar. PS: @gfwilliams, could this parameter - if present - be used to trigger the alternate interpretation which is applying |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-01 by Mrbbp Hello Markus, i've found that in the forum and it do the job as i expect.
the module send some char and the last one is the SUM of the transmitted string.
regards |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-01 by @allObjects Happy New Year to you too, Eric! I assume that your anonymous function in s(erial).on("data",function(d){...}) is not complete yet (because Composing the response though may change too, because data received my contain (parts) of more than one response (I do not know if this is possible with your device, but even then, when responses back up / congest for what ever reason, you will get there). Extract response one by one from composed received data and interpret only the extracted one. Checkout the gps module. It does this, because it receives multiple sentences and each has to be interpreted standalone. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-01 by Mrbbp i give you an example of a frame
if i've read and kept the good part in the gps module, it use an object and fill the "line" until it's more than 80chars or until \n char.
i do not have this '\n' in the frame module. 'Status', send back 5 chars thanks i'll try. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-01 by Mrbbp oh and a simple question about Upper-byte and Lower-Byte
to add these upper and lower bytes... should i do like this |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-01 by Mrbbp i've written something like that
and each command sent, fill the
Thanks for your help @allObjects. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-02 by @allObjects I know that you do not have responses ending with /n. But there is or are some thing(s) equivalent from which you can derive when a response is completely received. I took a look at the wiki of the device: https://www.dfrobot.com/wiki/index.php/Voice_Module_SKU:_DFR0534 The response is always: Together with the pre-amble of I can see something like this:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-31 by Mrbbp
Hello,
i'm working with Voice module from DFRobot
if i use an array of command i'm supposed to receive some datas
i'm trying to convert the data in hexa value...
when i'm trying
.toString(radix)
, console displays always the same char, not bin or oct or hex value...sorry, where i'm wrong?
it display
Beta Was this translation helpful? Give feedback.
All reactions