Need help with compiling and translating binary

basically i have a circuit that stores 4 bits of information and I want my arduino to read it I have the circuit set up but I don't know how to read the information on arduino I want the arduino to read then play music stored in the 4 bits of information even though it is barley anything I'm sorry if this sounds stupid I've never coded C++ in my life and never used a arduino

What is a circuit?
Where those 4 bits are stored?
Please show us more detail

Show the circuit complete with power supplies and code you have done so far.

ok lemme open this on my phone so I can send a photo its a breadboard circuit


the bits are held in sr latches read one by one through nand gates as 1 or 0

// C++ code
//
int animationSpeed = 0;

void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
}

void loop()
{
animationSpeed = 200;
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(2, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(2, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(3, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(3, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(4, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(4, LOW);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(5, HIGH);
delay(animationSpeed); // Wait for animationSpeed millisecond(s)
digitalWrite(5, LOW);
}
this is the code so far it just allows the info to be read one by one

Are you believe that your picture very useful?

I don't see ane SR reading in the code...

yea idk how to do that thats why I made the forum :sob: :sob:

the reading so far is analog its only reading whats on the sr latches onto a few led's

Sorry I do not understand you. Maybe my English is too weak.

What are the shift registers and how are they related to arduino?
What controls them?
Where do they get these 4 bits that need to be read from registers?

I advise you to start from the very beginning and state everything in detail

Read the MSB input, shift left, read the next input, shift left, read the next input, shift left, read the LSB .

The resulting value is your binary value.

im sorry what this is making me even more confused

the sr latches are soring the information and I want the stored information to be translated in the arduino then that translated information into a speaker to play as music

i understand after rereading but how do you do that like what functions do I use how do I do that

binaryValue = digitalRead(input4);
binaryValue = binaryValue << 1 + digitalRead(input3);
binaryValue = binaryValue << 1 + digitalRead(input2);
binaryValue = binaryValue << 1 + digitalRead(input1);

binaryValue contains your binary value.

so i add this to my code and then I decode binaryvalue and the decoded binary value back into an output pin to play the music?

@b707 as response to your answer of the sr latch thing its not directly read into the arduino because it does not allow it to be read 1 by 1

You can use switch/case to determine when something needs to be done.


switch (binaryValue)
{
   //*****
   case 0:
   //do something
   break;

   //*****
   case 1:
   //do something
   break;

   //*****
   case 2:
   //do something
   break;

   //*****
   case 4:
   //do something
   break;

}

also do i make binaryvalue a int value

Yes

Why read SR outputs into binary value first and then extract bits via switch case? may be better use the outputs from SR directly as a keys for code conditions?

That way you can get 0 thru 15 different combinations.