In this week I worked on the output and input devices, where I connect a sensor to a microcontroller and a breadboard.

Small Sound


I used a small sound sensor, connected it with a breadboard and a light. Then applied a code, where when someone claps the sensor will read the clap sound and then the light will blink to each sound detected.


Small Sound

A small sound sensor acts like a microphone that detects sound signals. The sensor will detect sound signals a provide digital or analog output.


Breadboard

A breadboard, solderless breadboard, or protoboard is a construction base used to build semi-permanent prototypes of electronic circuits. It allows components to be removed and replaced easily, it allows to build a circuit to demonstrate its action, then to reuse the components in another circuit.



                    /*

                  * Rui Santos
                 * Complete Project Details https://randomnerdtutorials.com
                 */

                int ledPin=13;
                int sensorPin=7;
                boolean val =0;

                void setup(){
                 pinMode(ledPin, OUTPUT);
                 pinMode(sensorPin, INPUT);
                 Serial.begin (9600);
                 }

                 void loop (){
                 val =digitalRead(sensorPin);
                Serial.println (val);
              // when the sensor detects a signal above the threshold value, LED flashes
              if (val==HIGH) {
             digitalWrite(ledPin, HIGH);
             }
             else {
            digitalWrite(ledPin, LOW);
            }
            }


The microcontroller is connected with the breadboard and the sensor by wires, each color go to a point and the colors are only used to dirrentiate and not get confused when working on the circut.