{"id":6231,"date":"2023-01-02T11:46:10","date_gmt":"2023-01-02T11:46:10","guid":{"rendered":"https:\/\/computerscienced.co.uk\/site\/?page_id=6231"},"modified":"2023-01-02T11:51:46","modified_gmt":"2023-01-02T11:51:46","slug":"what-are-logic-gates","status":"publish","type":"page","link":"https:\/\/computerscienced.co.uk\/site\/logic-gate-puzzles\/what-are-logic-gates\/","title":{"rendered":"What are Logic Gates?"},"content":{"rendered":"\n<p>Logic gates are like tiny little switches that can turn electricity on or off in a computer. They are used to make decisions, like whether to let electricity flow through or to stop it. Computers use logic gates to store and process information, like numbers and words.<\/p>\n\n\n\n<p>For example, if you wanted to make a simple computer that can add two numbers together, you would need to use some logic gates. You would start by using a logic gate called an &#8220;AND&#8221; gate to check if the two numbers are both bigger than zero. If they are, then the AND gate would let electricity flow through.<\/p>\n\n\n\n<p>There are 3 basic types of logic gates which you should know about and which we will cover below. <\/p>\n\n\n\n<p> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Logic Gates<\/h2>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:36% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"120\" height=\"50\" src=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/AND_ANSI_Labelled.svg\" alt=\"\" class=\"wp-image-6233 size-full\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p>An AND gate is a type of logic gate that only lets electricity flow through if both of the inputs are &#8220;on&#8221; or &#8220;true&#8221;. Imagine it like a door that only opens if you have the right key AND the right password.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:36% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"120\" height=\"50\" src=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/OR_ANSI_Labelled.svg\" alt=\"\" class=\"wp-image-6234 size-full\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p>An OR gate is a type of logic gate that lets electricity flow through if either of the inputs is &#8220;on&#8221; or &#8220;true&#8221;. Imagine it like a door that opens if you have the right key OR the right password.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:36% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"120\" height=\"50\" src=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/NOT_ANSI_Labelled.svg\" alt=\"\" class=\"wp-image-6235 size-full\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p>A NOT gate is a type of logic gate that inverts the input. If the input is &#8220;on&#8221; or &#8220;true&#8221;, the output will be &#8220;off&#8221; or &#8220;false&#8221;. If the input is &#8220;off&#8221; or &#8220;false&#8221;, the output will be &#8220;on&#8221; or &#8220;true&#8221;. Imagine it like a light switch &#8211; if the light is on, flipping the switch will turn it off, and if the light is off, flipping the switch will turn it on.<\/p>\n<\/div><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>These logic gates are all very simple, but they are the building blocks that computers use to store and process information. They are like the letters of the alphabet &#8211; by themselves, they are simple, but when you put them together in the right way, you can create all sorts of complex and interesting things.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Logic Circuits<\/h2>\n\n\n\n<p>A logic circuit is a way of using logic gates to process information. Imagine it like a bunch of tiny little switches that are all connected together in a specific way. Each switch can turn electricity on or off, and the way they are connected determines what the logic circuit does.<\/p>\n\n\n\n<p>Imagine you want to build a logic circuit that can turn a light on or off based on the time of day. You could use a NOT gate followed by an OR gate. The NOT gate would invert the input from the light sensor, and the OR gate would have two inputs, A and B. Input A would represent the inverted output from the light sensor, and input B would represent whether it is nighttime. If either A or B is &#8220;true&#8221;, then the OR gate will allow electricity to flow through and turn the light on. If both A and B are &#8220;false&#8221;, then the OR gate will not allow electricity to flow, and the light will stay off.<\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:41% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-1024x481.webp\" alt=\"\" class=\"wp-image-6236 size-full\" srcset=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-1024x481.webp 1024w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-300x141.webp 300w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-768x361.webp 768w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-320x150.webp 320w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-480x226.webp 480w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-800x376.webp 800w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-50x24.webp 50w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-100x47.webp 100w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-600x282.webp 600w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on.webp 1242w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>To make this logic circuit work, you would need to use some sensors to detect the time of day and send a &#8220;true&#8221; or &#8220;false&#8221; signal to the OR gate. For example, you could use a light sensor to detect if it is daytime and a temperature sensor to detect if it is night time. If it is daytime, the light sensor would send a &#8220;true&#8221; signal to the NOT gate, which would invert the signal and send a &#8220;false&#8221; signal to input A of the OR gate. The temperature sensor would send a &#8220;false&#8221; signal to input B of the OR gate. This would cause the OR gate to not allow electricity to flow, and the light would stay off.<\/p>\n<\/div><\/div>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:41% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-1024x481.webp\" alt=\"\" class=\"wp-image-6237 size-full\" srcset=\"https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-1024x481.webp 1024w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-300x141.webp 300w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-768x361.webp 768w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-320x150.webp 320w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-480x226.webp 480w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-800x376.webp 800w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-50x24.webp 50w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on-100x47.webp 100w, https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-off-temp-on.webp 1242w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>If it is night time, the light sensor would send a &#8220;false&#8221; signal to the NOT gate, which would invert the signal and send a &#8220;true&#8221; signal to input A of the OR gate. The temperature sensor would send a &#8220;true&#8221; signal to input B of the OR gate, which would cause the OR gate to allow electricity to flow and turn the light on.<\/p>\n<\/div><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>This is just one example of a simple logic circuit. There are all sorts of different logic circuits that can do all sorts of different things, and they are all very important for making computers work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Logic gates are like tiny little switches that can turn electricity on or off in a computer. They are used&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6236,"parent":2044,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"disable_featured_image":true,"footnotes":""},"class_list":["post-6231","page","type-page","status-publish","has-post-thumbnail","hentry"],"blog_post_layout_featured_media_urls":{"thumbnail":["https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on-150x150.webp",150,150,true],"full":["https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2023\/01\/logic-circuit-light-sensor-on.webp",1242,584,false]},"categories_names":null,"comments_number":"0","_links":{"self":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/comments?post=6231"}],"version-history":[{"count":4,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6231\/revisions"}],"predecessor-version":[{"id":6243,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6231\/revisions\/6243"}],"up":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/2044"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/media\/6236"}],"wp:attachment":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/media?parent=6231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}