Give binary values to my arduino inputs

I just don't get how it works

I could understand having buttons on both sides and then the user must press a button in the Question column and the matching button in the Answer column and the arduino knows if it's good or wrong because somehow those two buttons had been connected in series for example through the cassette


each cassette can join the buttons in a specific way

but I don't get the idea of buttons on one side and leds on the other side.

@ jim-p
you still there?

@J-M-L
Forget about it.
have a look on: Give binary values to my arduino inputs - #39 by hosninfogate

I give up. I don't get what you are saying. (may be post in the French speaking section?)

I think my english is so clear and the request is clear (Maybe the concept idea is difficult to imagine just by screen shots and messages)
No need to go to any section.
Thank you so much for your help. for sure i will need your help next time for something else.

your thread, your call.

good luck with your project.

Your code could be as simple as this

const byte codePins[] = { A0, A1, A2, A3 };
const byte PINCOUNT = sizeof(codePins) / sizeof(codePins[0]);

void setup()
{
    Serial.begin(115200);
    for (int p = 0; p < PINCOUNT; p++)
    {
        pinMode(codePins[p], INPUT_PULLUP);
    }
}

void loop()
{
    byte codeByte = 0;
    for (int p = 0; p < PINCOUNT; p++)
    {
        bitWrite(codeByte, p, digitalRead(codePins[p]));
    }
    for (int p = 0; p < PINCOUNT; p++)
    {
        Serial.print(bitRead(codeByte, p));
    }
    Serial.println();
    delay(1000);
}

Once you have the value in the codeByte variable you can test it and take appropriate action

Thank you so much.
nice i will try it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.