I am new to coding in C using a Arduino Uno. I would like to do the following:
int randomNumber;
int randomNumberBinairy = 0;
void setup() {
Serial.begin(9600);
randomSeed(analogRead(A0));
}
void loop() {
randomNumber = random(1, 16);
randomNumberBinairy = ((randomNumber, BIN));
Serial.println(randomNumberBinairy);
delay(5000);
}
This prints out:
2
2
2
2
etc..
However I would like it to print out the random number (between 1 and 16) in binary. So it should look something like:
101
1100
110
10
etc..
Any help on this please?