This parseInt() something you want?
Try parseInt("23", 16)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

I'm on mobile, if anything is incorrect then sorry.

On Thu, Dec 4, 2014, 10:22 PM P THE AWESOME <p2kwolfg...@live.com> wrote:

> I am trying to convert a string with the byte number in it into a real
> byte.
>
> var string = "23"; // Or it could be 4E, CA, 22, FF, or any other byte
> var byte = somehowConvertStringToByte(string); // The variable "byte"
> Should look like 0x23 to NodeJS
> var otherByte = 0x23; // This is 100% equal to the variable "byte."
> NodeJS will see this variable and "byte" the exact same way.
>
> Hopefully this makes sense. I'm have to generate some stupid checksums to
> get my UPB serial PIM to accept commands. I have the reset of the code
> working. I'm making a CLI script that generates UPB commands and then sends
> them with node-serialport.
>
> Thank you for any help, as this has completely stumped me.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/90d6eac1-bfff-4ded-8bef-bed54b8634ee%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/90d6eac1-bfff-4ded-8bef-bed54b8634ee%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAKUejdeOpY5cg0_ev8MOQ-Yo5wU3kfXLMyGFPZ4Sj1w7XRXSug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to