# Decimal commands for trex Jr

I am having a problem understanding the code to set motors 1&2 backwards on a TReX Jr. I have my trex successfully connected to an RP-5 Chassis and I can move the platform foward by sending

``````SEROUT MCTX ,84, [194, 000]
SEROUT MCTX, 84, [202, 000]``````

from my BASIC Stamp 2. However, I cannot locate the decimal equivalents of the commands listed in the user’s guide. I would like to use the decimal equivalents because my control system inputs integers to the BASIC Stamp. Any help is appreciated.

Hello.

The decimal equivalents aren’t written anywhere, but it’s pretty easy to convert between hex and decimal. If your hex number has the digits xyz, you can convert this to decimal by performing:

x*16^2 + y*16^1 + z*16^0 = x*256 + y*16 + z

So, for example, let’s say you have the hex number 1F (often written as 0x1F or h1F to denote that it is represented in hexidecimal). This can be converted to base-10 (decimal) by:

1*16 + 15 = 31

In hex, the digits from 10 to 15 are written as A through F, respectively.

You probably don’t need to do these computations yourself, though. What is your control system and how is it sending data to the Basic Stamp? I’d be surprised if this control system didn’t let you write values in hex. Also, Window’s calculator tool in “Scientific” mode can do these kind of conversions for you. Click the “hex” radio button, enter the hex number, and then click the “dec” radio button to perform the conversion.

- Ben

I frequently use Google Calculator to convert hex representations to decimal representations and vice-versa:

–David

My control system is a Basic Stamp 2 which is polling a resistor/capacitor circuit. My reasoning for not just using the analog ins is that I need the Basic Stamp to keep a realtime connection with my mac through bluetooth.