Serial print data in HEX or DEC not coming.

i am sending array data which is byte data. on serial print but my data is in 0 and 1 in form of bits, it is actually digital read pin data either 0 or 1 . i am getting only something like in this binary patterns 01100010 on serial port window. i want to it in DECimal or HEXadecoimal. for that i am using instruction Serial.print(data*,HEX) for hex and DEC for decimal value. but i am not getting output in HEX or DEC. i am getting the same as binary0 and 1s. kindly suggest something. Thanks*

Your terminology is all wrong. What you really want to do is convert input bits to a byte, and then print that byte in hex. Have a look at the “Bits and Bytes” list of functions on the reference page for good ideas. If you’re smart, you will figure out how to use those to do what you want.

Thanks aarg.

I am storing each bit data into array. i want to send this array to serial window in Decimal.

do u mean to say i have to use bitread() instruction ??

To send a byte to serial in decimal, you just use serial.print(). If you have an array of bytes that each contain a 1 or a 0, you're on the wrong track. It wastes a lot of memory. Perhaps it is time to ask you exactly what you're trying to do, i.e. why do you want to do this? Otherwise this is going to go back and forth with no resolution. Even if other people post.

Of course you can write code to read such an array and print it in different ways, but I suspect you are labouring under some misapprehension about your needs.

thats ok, but i m storing 8 digital pin's data into array, and i m doing the same serial print. as u suggested. but i am getting only 10110010. where i am wrong? i want solution. kindly help me./

Serial.print ((int)x, HEX);

or

Serial.print ((int)x, DEC);

works for me.
Can you post the code that shows your problem?

Use code tags.

Thanks AWOL. Kindly see my code , I am using DUE.

byte pins[8]={22,23,24,25,26,27,28,29};
byte data1[8];
int i;

void setup()
{
Serial.begin(115200);

for (int a=0; a<=8;a++)
{
pinMode(pins[a],INPUT);
}
}

void loop()
{
for ( i=0;i<=8;i++){

data1_=digitalRead(pins*);_
_Serial.print(data1, DEC);
}*
Serial.println();_

}

Now can you see why I asked you to use code tags?

Please edit your post to add them.

for (int a=0; a<=8;a++)

Accessing all nine elements of an eight element array.
Oops

i am getting only 10110010.

What do you expect to get when reading a digital input ?

I told you, you need to pack the bits into a byte.

Thanks all of you.