For the inputs (12, 13) and the outputs (3, 4, 5, 6).
I corrected the INPUT_PULLUP syntax and added missing semicolons.
I corrected the NAND/NOR logic to use the ! (NOT operator) for logic.
I standardized variable names (pinAND instead of pinNMD).
I removed duplicate/incorrect pinMode calls.
I corrected the logic in the digitalWrite statements.
In the wiring:
The switches are connected between GND and pins 12/13 (internal pull-up enabled).
The LEDs are connected each to pins 3-6 (through a current limiting resistor) to show AND/OR/NAND/NOR outputs.
/*Paste your code here*/
const int inputA = 12;
const int inputB = 13;
const int pinAND = 6;
const int pinOR = 3;
const int pinNAND = 5;
const int pinNOR = 4;
void setup() {
pinMode(inputA, INPUT_PULLUP);
pinMode(inputB, INPUT_PULLUP);
pinMode(pinAND, OUTPUT);
pinMode(pinOR, OUTPUT);
pinMode(pinNAND, OUTPUT);
pinMode(pinNOR, OUTPUT);
}
void loop() {
bool A = (digitalRead(inputA) == LOW);
bool B = (digitalRead(inputB) == LOW);
digitalWrite(pinAND, (A && B) ? HIGH : LOW);
digitalWrite(pinOR, (A || B) ? HIGH : LOW);
digitalWrite(pinNAND, (!(A && B))? HIGH : LOW);
digitalWrite(pinNOR, (!(A || B))? HIGH : LOW);
}
Add a video of the output (know more)