Welcome to the Parallax Discussion Forums, sign-up to participate.

LittleB
Posts: **2**

I want to use the potentiometer to provide input to a neural network, so I want to convert the rctime number to a binary number, and then separate it into 1 digit lengths.

For example, say the potmeter gives the rctime value of 323. In binary it would be 0101000011. Then in a format understandable by the neural net, it would be split, literally, into 10 separate digits, i.e. 0, 1, 0, 1, 0, 0, 0, 0, 1, and 1. Each of these would be stored as a variable (or a constant?).

Another example would be the number 700 (around the max of the potmeter). In binary it would be 1010111100. So again, split into 10 digits this would be: 1, 0, 1, 0, 1, 1, 1, 1, 0, and 0.

So the steps pbasic would have to perform would be as follows:

1. Take the number of the current rctime and convert it to binary.

2. Take that binary number and split it into 10 separate digits.

3. Store each of those digits as a variable.

I've been trying to look through the documentation, trying to figure out how to do this. Can anybody help me?

For example, say the potmeter gives the rctime value of 323. In binary it would be 0101000011. Then in a format understandable by the neural net, it would be split, literally, into 10 separate digits, i.e. 0, 1, 0, 1, 0, 0, 0, 0, 1, and 1. Each of these would be stored as a variable (or a constant?).

Another example would be the number 700 (around the max of the potmeter). In binary it would be 1010111100. So again, split into 10 digits this would be: 1, 0, 1, 0, 1, 1, 1, 1, 0, and 0.

So the steps pbasic would have to perform would be as follows:

1. Take the number of the current rctime and convert it to binary.

2. Take that binary number and split it into 10 separate digits.

3. Store each of those digits as a variable.

I've been trying to look through the documentation, trying to figure out how to do this. Can anybody help me?

Tagged:

## Comments

6 Commentssorted by Date Added Votes1,4290Vote UpVote DownYou could create an array for each bit of the number and read the bits into the array something like the following

Jeff T.

14,2120Vote UpVote Down▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Chris Savage

Parallax Engineering

50 72 6F 6A 65 63 74 20 53 69 74 65

·

Chris Savage| Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+20Vote UpVote DownThanks Unsoundcode, I'm not sure what the heck you explained to me, but I may be able to figure it out =)

Apologies, I am still new at programming.

1,4290Vote UpVote Down·http://www.savagecircuits.com/

is that new or have I been to blind to see it , neat link.

Jeff T.

14,2120Vote UpVote Down▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Chris Savage

Parallax Engineering

50 72 6F 6A 65 63 74 20 53 69 74 65

·

Chris Savage| Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+