char buff[9];
long rnd;
 
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}
 
void loop() {
  // put your main code here, to run repeatedly:
  rnd = random(255);
  Serial.print("DEC: "); Serial.println(rnd);
  utoa(rnd, buff, BIN);
  Serial.print("BIN: "); Serial.println(buff);
  utoa(rnd, buff, HEX);
  Serial.print("HEX: "); Serial.println(buff);
  //bitread
  Serial.print("bitread: ");
  for (int x = 0; x < 8; x++) {
    Serial.print(bitRead(rnd, x));
  }
  Serial.println();
  //bitread reverse
  Serial.print("bitread reverse: ");
  for (int b = -7; b < 1; b++) {
    Serial.print(bitRead(rnd, -b));
  }
  Serial.println();
 
  Serial.println("-------");
  delay(2222);
}