Let's Make Robots!

Binary Number directly from Arduino I/O pins?

Hey guys, I know there has got to be a way to do this, but I can't seem to find it at the Arduino reference page and I don't seem to be using the correct google terms.

I have a 4-bit parallel output from a chip going to 4 digital input pins on an arduino. The chip I am using is putting out a nibble of 4 bits representing a number in binary form. I need the arduino to read the state of these 4 pins and give me a number. I have done this via Picaxe in the past, but I can't seem to find the same thing in Arduino.

There has got to be an easy way of doing this without a lot of bit shifting and or simply assigning values to each input pin and adding them.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Var = PINB is what I needed my friend, thank you. I'll take all 8 bits, no worries, if all I have to do is shove 'em over or "and" them once, I think I can handle that. 

Groovy groovy.