How I set up my breadboard:

  • Placed SN74LS08N (AND gate) on a breadboard.
  • Connected IC pin 7 to GND and IC pin 14 to 5 V for IC to get powered.
  • Connected GPIO pin 16 to IC pin 13,
  • Connected GPIO pin 12 to IC pin 12 and
  • Connected GPIO pin SCLK to IC pin 11.
  • Connected LEDs’ anode (+) to GPIO 12, 16 and SCLK,
  • Connected LEDs’ cathode (-) to one end of resisters and
  • Connected the other end of resisters to GND

I'm fairly new to Raspberry Pi and for some reason I cant wrap my head around how to write a python code to simulate an AND gate.

  • Hello @Vinx7, Welcome and nice to meet you. Ah, let me see. First, requirement and specification. (1) User requirement v0.1: "How to simulate TTL AND gate SN74LS08N using Rpi python", (2) Functional spec suggestion v0.1: "Input parameters: in1a, in1b, in2a, in2b, ... in4a, in4b (b) Output parameters: out1y, ... out4y". Your comments and counter suggestions welcome. Best Regards, Your sincerely, Ta and cheers.
    – tlfong01
    Feb 27, 2020 at 3:17
  • Notes on Spec v0.1: We need to agree that we only want to simulate the logical input/output states. In other words, we will confine to function logical truth table (Table 1 of datasheet below). We don't care about power supply features, operating frequency and timing, temperature ranges etc. References: (1) SNx4HC08 Quadruple 2-Input Positive-AND Gates Datasheet - TI (Texas Instruments) 2016june: ti.com/lit/ds/symlink/sn74hc08.pdf.
    – tlfong01
    Feb 27, 2020 at 3:53
  • We also need to agree on the use of technical terms: such as TTL/CMOS, Positive/Negative logic etc. I would suggest to follow "Electronics Tutorials". (1) "Digital Logic GatesDigital Logic Gates - Eletronics-Tutorials": electronics-tutorials.ws/logic/logic_1.html, electronics-tutorials.ws/logic/logic_2.html (2) "Logic AND Gate Tutorial": electronics-tutorials.ws/logic/logic_2.html.
    – tlfong01
    Feb 27, 2020 at 4:05
  • Hello. Rather than a list of connections it's much easier to understand the question if you include a schematic drawing -- there's a tool included for this, press Ctrl+M when editing to open it. I'm not clear what you want your Python code to do: exercise the two inputs to the AND gate you've connected and report back on it's output? Ignore the physical AND gate and simulate it's function on the GPIO? Feb 27, 2020 at 8:56
  • 1
    I figured it out thanks for the help guys. It was with 2 LEDs
    – Vnix7
    Feb 27, 2020 at 20:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.