Hi, I searched online to use analog pin inputs (A0,A1,....) as on port (port C in arduino Uno) I think nothing needed in void setup and to read inputs i can use "int p = PINC;" but how to put in variable p values of A2,A3,A4,A5 only whether if A0,A1 are high or low ?? in other words making A2,A3,A4,A5 as new port
You mean you want a var with only the state of A2...A5 ?
byte sub = PINC & 0b00111100;
that's Exactly what i want but how to convert it into integer number int sub = PINC & 0b00111100; ?!!
MohamedSamy: that's Exactly what i want but how to convert it into integer number int sub = PINC & 0b00111100; ?!!
"sub" is an integer number - that's what "int" means.
If you want it in its minimal form, shift it right two places, aka divide it by four.
Do you mean integer, as in 16-bit value? Seems an odd thing to do when you only have 4 bits, with a value from 0 to 15. If you do this: Serial.println( (PINC & 0b00111100)>>2), DEC); You will see 0 to 15 on the serial monitor. Is that what you are after?