<commit_before>---
layout: post
title: Switch
---

> Imagine building a computer using a switch!!!

Thats totally absurd.How can you build a computer using a switch!! Impossible!!
Hmmm.....
May be it is possible to build one....

Lets work out the math.
A [switch](https://en.wikipedia.org/wiki/Switch) is a simple mechanism of controlling the flow between 2 ends.In order to build a computer you need basic logic gates.(Recall Electronics 101 The [AND](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s and the [OR](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s and the [NOT](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s).Thats the holy grail!!
If you can build these gates may be we inch towards the massive goal.

GREAT!!!Lets get started then.

How do we build one?
Lets start with [AND](https://en.wikibooks.org/wiki/Electronics/Basic_gates). The logic AND outputs high if all the inputs are high.
{% highlight text %}

    ....! ....! ....
   ___              .
    -              .
    .......`O`......
    
    AND using Switches
    
 Imagine those ! symbols as switches.`0` is our Glowy BULB.[Stop thinking of it as birthday cake]

{% endhighlight %}
If one of the switch is closed the bulb will not glow. The Bulb Glows only when both switches are closed.So we have our AND gate ready. Great going!!!

The [OR](https://en.wikibooks.org/wiki/Electronics/Basic_gates).
The logic OR outputs high if any of its inout is high.

{% highlight text %}

       ....! ....
       .        .
    ....        .......
    .  .        .     .
    .  ....! ....     .
   ___               `O`
    -                 .
    ...................
    
    OR using Switches

{% endhighlight %}

Even if one of the switch is closed the bulb glows.We have our OR.

The naughty [NOT](https://en.wikibooks.org/wiki/Electronics/Basic_gates):
you say high i say low, I say low you say high.....
### Images
[!NOT](http://www.electronics-tutorials.ws/boolean/boo11.gif?81223b)    
    
    NOT using Switches

Here is the logical way of representing the logic gates.
[!gates](http://www.waitingforfriday.com/index.php/File:Slide6.PNG)

Now that we all out ingredients ready, we can cook our meth now.

Next up, Lets use these to build an adder circuit.

[!Full Adder](http://www.waitingforfriday.com/index.php/File:Slide10.PNG) 

Nothing fancy. Just work out the math.I am sure all the electronics 101 bells are ringing now!!!<commit_msg>switch<commit_after>---
layout: post
title: Switch
---

> Imagine building a computer using a switch!!!

Thats totally absurd.How can you build a computer using a switch!! Impossible!!
Hmmm.....
May be it is possible to build one....

Lets work out the math.
A [switch](https://en.wikipedia.org/wiki/Switch) is a simple mechanism of controlling the flow between 2 ends.In order to build a computer you need basic logic gates.(Recall Electronics 101 The [AND](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s and the [OR](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s and the [NOT](https://en.wikibooks.org/wiki/Electronics/Basic_gates)'s).Thats the holy grail!!
If you can build these gates may be we inch towards the massive goal.

GREAT!!!Lets get started then.

How do we build one?
Lets start with [AND](https://en.wikibooks.org/wiki/Electronics/Basic_gates). The logic AND outputs high if all the inputs are high.
{% highlight text %}

    ....! ....! ....
   ___              .
    -              .
    .......`O`......
    
    AND using Switches
    
 Imagine those ! symbols as switches.`0` is our Glowy BULB.[Stop thinking of it as birthday cake]

{% endhighlight %}
If one of the switch is closed the bulb will not glow. The Bulb Glows only when both switches are closed.So we have our AND gate ready. Great going!!!

The [OR](https://en.wikibooks.org/wiki/Electronics/Basic_gates).
The logic OR outputs high if any of its inout is high.

{% highlight text %}

       ....! ....
       .        .
    ....        .......
    .  .        .     .
    .  ....! ....     .
   ___               `O`
    -                 .
    ...................
    
    OR using Switches

{% endhighlight %}

Even if one of the switch is closed the bulb glows.We have our OR.

The naughty [NOT](https://en.wikibooks.org/wiki/Electronics/Basic_gates):
you say high i say low, I say low you say high.....

![NOT](http://www.electronics-tutorials.ws/boolean/boo11.gif?81223b)    
    
    NOT using Switches

Here is the logical way of representing the logic gates.
![gates](http://www.waitingforfriday.com/index.php/File:Slide6.PNG)

Now that we all out ingredients ready, we can cook our meth now.

Next up, Lets use these to build an adder circuit.

![Full Adder](http://www.waitingforfriday.com/index.php/File:Slide10.PNG) 

Nothing fancy. Just work out the math.I am sure all the electronics 101 bells are ringing now!!!
{'fraction_non_alphanumeric': 0.13086217489248414, 'fraction_numerical': 0.0073725168953512185, 'mean_word_length': 2.4835948644793153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 14, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4197827', 'n_tokens_mistral': 1592, 'n_tokens_neox': 1493, 'n_words': 540}