i quote:
" //this is line uses a bitwise operator
//shifting a bit left using << is the same
//as multiplying the decimal number by two.
pin = 1<< p;"
from: http://arduino.cc/en/Tutorial/ShftOut12
Say p was equal to 2, then what is pin equal to? i dont understand what the << is doing.
Edit: furthermore what is a bitwise operator, and what does it mean by shifting a bit left.
it looks you never heard of binary...
here are the binary translation of the value you mantionned... hope you'll see the action of the shift operator...
0x01 = 00000001b
0x02 = 00000010b
0x04 = 00000100b
0x08 = 00001000b
0x10 = 00010000b
...
and for the reference 3 and let's say 5 would be coded like that:
0x03 = 00000011b
0x05 = 00000101b
if you don't know binary it might be a good idea to read the basic there:
take also the care to learn about two complement, that'll avoid you some painful problems with signed value...
An old programming trick to do an integer multiplication by ten is to shift the multiplicand left once, store the result in a temporary, then shift the result twice more (three shifts total = multiply by 8) , then add in the temporary.