Arduino sketch from truth table

Hello everyone, I am doing a small project for my internship and I need some help. I have been given a truth table and I need to write an arduino sketch from it. How do I do it correctly cause I want to learn it from the beginning to do it properly. My idea was just to create a boolean equation for the truth table and interpret it with C directly into arduino sketch. Here is the Table:

S1 S2 S3 S4 S5 S6 Port
0v 5v -- 0v 0v -- 1
0v 5v -- 5v -- 5v 2
0v 5v -- 5v -- 0v 3
0v 5v -- 0v 5v -- 4
5v -- 0v 0v 0v -- 5
5v -- 0v 5v -- 5v 6
5v -- 0v 5v -- 0v 7
5v -- 0v 0v 5v -- 8
5v -- 5v 0v 0v -- 9
5v -- 5v 5v -- 5v 10
5v -- 5v 5v -- 0v 11
5v -- 5v 0v 5v -- 12
0v 0v -- -- -- -- 13

What field did you graduate in?

electrical engineering

Are you sure that you shall write 13 equations for 13 distinct outputs?

I'd suspect that it's a single output, true under any of the given table entries.

Did that include the subject of discrete math?

not really no

Wow. Anyway as the good doctor implied, we need better information on the assignment. It doesn't make sense from only what you posted.

What is "port" and what are "S1, S2..."?

My bad I should have explained it a bit more, so I will try now. We are building a circuit board so to say switch which has 13 ports on it and 6 buttons each port will activate if the above mentioned states are present. Does it make any sense now?

means what? Please provide a schematic. Or at least a very good, very detailed explanation. Something you might not know, the forum software places a limit on the number of posts you can make in the first day. So you have to try and anticipate what people need to know, and post it all in a minimal number of posts, without being asked.

Unfortunately I don't have any schematic. But imagine some kind of a 13 relay module and the buttons are the S1-S6. I hope you can understand now better

Absolutely not enough information. Not even for you. This is not a standard truth table. What is the meaning of the '--' symbols? Are those "don't care" conditions?

Yes I know! Truth table is not really the right word to it, I just googled it and it gave me this translation. S1-S6 are the inputs and Ports are the outputs. This is a PLC table and I need to translate it to a arduino sketch, does it make any sense now? Sorry english is not my mother language so I am trying now hard to translate all this.

Okay, as I told you, you will soon be locked out of responding for a day. So, is there anything else you forgot to tell us?

No, this was all I got to say. I have this "PLC" table and I need to translate it to an arduino sketch. And I wanted to do it the right way that's why I came here. My initial idea was just row by row translate it into a C program and than write it to arduino.

would be

bool out11 = S1 and S3 and S4 and not S6;

I'm just assuming that '--' is a "don't care" state because you didn't answer.

You mean you have a choice of languages and platforms? Or you've been asked to use an Arduino?

I do have a choice, my language of choice is C but we use arduino uno for this project. And I know that arduino understands C.

You're running out of replies... you will get locked out. You have to say more in each post. Use Google translate if you need help with English.

What do you think about reply#15?

I'd like to know exactly the difference between the stated requirements of your assignment, and your choices of solution. You can change your choices, but maybe not the requirements.

1 Like

Yes this is how I imagined it to do but I will write the same in C with if else statements!

Why on earth would you do that? This is why I asked about the requirements. Earlier, you mentioned a need for boolean expressions...

It would be so cumbersome in if-else (assuming you mean, testing each variable one at at time)!

1 Like