// Starter sketch
// Forum: https://forum.arduino.cc/t/converting-an-input-decimal-to-led-binary-output/1169026
// This Wokwi project: https://wokwi.com/projects/376015409717764097
void setup()
{
Serial.begin(115200);
Serial.println("Type a number");
}
void loop()
{
if(Serial.available() > 0)
{
// Something has been received.
// The Arduino .parseInt() has a timeout of 1 second.
int x = Serial.parseInt();
Serial.print("Your number is ");
Serial.println(x);
// clear any trailing CarriageReturn and/or LineFeed
while(Serial.available() > 0)
{
Serial.read();
}
delay(500);
Serial.println("Type a number");
}
}