From Byte to Binary conversion [SOLVED]

Hello guys,
I would like to convert a value from 'INT' (0 to 255) in binary (0000000 to 1111111)
and then print it on the serial port to view it.

Seccessivamente would like to read and write every single bit and make comparisons with the IF function

Thank you very much, now how can I make the comparison with the if function of the bit x?

int value = 100 ;
void setup() {

Serial.begin (115200);
}

void loop() {
if (value,bin bit 1== 1) { do something}; // how to spell correctly?
  
Serial.println (value,BIN);
}

and how can I write a bit?

Already done for you, check out the BitXXX() functions : bitRead(), bitSet)(, bitClear(), et, al.

Here's some ideas using bit shifting to get all 8 bits of the number printed, and then using bitRead() for the conditional testing.

void setup() {

  Serial.begin(9600);
  byte x = 47;
  printBinary(x);
  bitTest(x);

}

void loop() {

}
void printBinary(byte b) {
  for (int i = 7; i >= 0; i-- )
  {
    Serial.print((b >> i) & 0X01);//shift and select first bit
  }
  Serial.println();
}

void bitTest(byte b) {
  for (int i = 7; i >= 0; i-- )
  {
    Serial.print("Bit Number ");
    Serial.print(i);
    Serial.print (" is ");
    Serial.println(bitRead(b, i));
    if (bitRead(b, i) == 1)
      Serial.println ("//code if match 1");
    else
      Serial.println ("//code if match 0");
    Serial.println();
  }
}

i trying

that's right ?

int value = 100 ;

void setup() {
pinMode(13, OUTPUT);
Serial.begin (9600);
}
void loop() {
if(bitRead(value, 7) == 1){digitalWrite(13, HIGH);}   
Serial.println (value,BIN);
}

Grazie a tutti ragazzi,
di seguito quello che volevo imparare per gestire una serie di parole da inviare e ricevere by comunicazione rs485

byte value = 0 ;

void setup() {
pinMode(13, OUTPUT);
Serial.begin (9600);
}
void loop() {
if(bitRead(value,0) == 1){digitalWrite(13, HIGH);}  
else {digitalWrite(13, LOW);} 
value++;
if(bitRead(value,4) == 1){value =0 ;}
delay (100);
Serial.println (value,BIN);
}

P:s:how to make [solved] ??

int value = 100 ;

void setup() {
pinMode(13, OUTPUT);
Serial.begin (9600);
}
void loop() {
if(bitRead(value, 7) == 1){digitalWrite(13, HIGH);}   
Serial.println (value,BIN);
}

value is not changed.
If value is 100 decimal, and you print it in binary format, what will you get?

LarryD:

int value = 100 ;

void setup() {
pinMode(13, OUTPUT);
Serial.begin (9600);
}
void loop() {
if(bitRead(value, 7) == 1){digitalWrite(13, HIGH);} 
Serial.println (value,BIN);
}




value is not changed.
If value is 100 decimal, and you print it in binary format, what will you get?

It was just to try to manually change the bit to compare.
the last is clear and running