cover photo

BLOG · 13/4/2023

COMMON TASK REPORT-2

this post is consists of report of common task from 6 to 9

Anjal K Nair
Anjal K Nair
OP
COMMON TASK REPORT-2
This Article is yet to be approved by a Coordinator.

TASK-6\n# LED TOGGLE\n\nthe task is to make standalone web server with an ESP32 to controls the LED connected with ESP32 GPIOs\n\n## MATERIALS REQUIRED :\n1. BREAD BOARD\n2. TWO LED LIGHTS\n3. TWO RESISTORS\n4. JUMPER WIRES \n5. ESP32 MICROCONTROLER\n\n## ESP32 MICROCONTROLLER :\nESP32 is a low-cost, low-power Microcontroller with an integrated Wi-Fi and Bluetooth. It is the successor to the ESP8266 which is also a low-cost Wi-Fi microchip albeit with limited vastly limited functionality.\n\nESP32 are commonly found in\n * Smart industrial devices. \n * including Programmable Logic Controllers (PLCs). \n * Smart medical devices.\n * wearable health monitors.\n * Smart energy devices.\n * HVAC and thermostats.\n\n alt text\n\n## CIRCUIT WORKING:\nonce the circuit is connected properly ,upload the the codes to microcontroller ,once the code is uploaded we should give the particular WIFI SSID and Password will be receiving an IP address when the WIFI gets connected .\n\n## CODES TO BE UPLOADED IN THE MICROCONTROLLE :\ncopy the IP address and paste it in chrome ,we will be receiving an web page with the option of ON and OFFR* :\n c\n // Load Wi-Fi library\n#include \n\n// Replace with your network credentials\nconst char* ssid = \vvvvvvxxxxxx\";\nconst char* password = vvvvvvxxxxxx\";\n\n// Set web server port number to 80\nWiFiServer server(80);\n\n// Variable to store the HTTP request\nString header;\n\n// Auxiliar variables to store the current output state\nString output26State = \"off\";\nString output27State = \"off\";\n\n// Assign output variables to GPIO pins\nconst int output26 = 26;\nconst int output27 = 27;\n\n// Current time\nunsigned long currentTime = millis();\n// Previous time\nunsigned long previousTime = 0; \n// Define timeout time in milliseconds (example: 2000ms = 2s)\nconst long timeoutTime = 2000;\n\nvoid setup() {\n Serial.begin(115200);\n // Initialize the output variables as outputs\n pinMode(output26, OUTPUT);\n pinMode(output27, OUTPUT);\n // Set outputs to LOW\n digitalWrite(output26, LOW);\n digitalWrite(output27, LOW);\n\n // Connect to Wi-Fi network with SSID and password\n Serial.print(\"Connecting to \");\n Serial.println(ssid);\n WiFi.begin(ssid, password);\n while (WiFi.status() != WL_CONNECTED) {\n delay(500);\n Serial.print(\".\");\n }\n // Print local IP address and start web server\n Serial.println(\"\");\n Serial.println(\"WiFi connected.\");\n Serial.println(\"IP address: \");\n Serial.println(WiFi.localIP());\n server.begin();\n}\n\nvoid loop(){\n WiFiClient client = server.available(); // Listen for incoming clients\n\n if (client) { // If a new client connect \n currentTime = millis();\n previousTime = currentTime;\n Serial.println(\"New Client.\"); // print a message out in the serial port\n String currentLine = \"\"; // make a String to hold incoming data from the client\n while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client\'s connected\n currentTime = millis();\n if (client.available()) { // if there\'s bytes to read from the clien \n char c = client.read(); // read a byte, then\n Serial.write(c); // print it out the serial monitor\n header += c;\n if (c == \'\\n\') { // if the byte is a newline character\n // if the current line is blank, you got two newline characters in a row.\n // that\'s the end of the client HTTP request, so send a response:\n if (currentLine.length() == 0) {\n // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)\n // and a content-type so the client knows what\'s coming, then a blank line:\n client.println(\"HTTP/1.1 200 OK\");\n client.println(\"Content-type:text/html\");\n client.println(\"Connection: close\");\n client.println();\n \n // turns the GPIOs on and off\n if (header.indexOf(\"GET /26/on\") >= 0) {\n Serial.println(\"GPIO 26 on\");\n output26State = \"on\";\n digitalWrite(output26, HIGH);\n } else if (header.indexOf(\"GET /26/off\") >= 0) {\n Serial.println(\"GPIO 26 off\");\n output26State = \"off\";\n digitalWrite(output26, LOW);\n } else if (header.indexOf(\"GET /27/on\") >= 0) {\n Serial.println(\"GPIO 27 on\");\n output27State = \"on\";\n digitalWrite(output27, HIGH);\n } else if (header.indexOf(\"GET /27/off\") >= 0) {\n Serial.println(\"GPIO 27 off\");\n output27State = \"off\";\n digitalWrite(output27, LOW);\n }\n \n // Display the HTML web page\n client.println(\"\");\n client.println(\"\");\n client.println(\"\");\n // CSS to style the on/off buttons \n // Feel free to change the background-color and font-size attributes to fit your preferences\n client.println(\"\");\n \n // Web Page Heading\n client.println(\"ESP32 Web Server\");\n \n // Display current state, and ON/OFF buttons for GPIO 26 \n client.println(\"GPIO 26 - State \" + output26State + \"\");\n // If the output26State is off, it displays the ON button \n if (output26State==\"off\") {\n client.println(\"ON\");\n } else {\n client.println(\"OFF\");\n } \n \n // Display current state, and ON/OFF buttons for GPIO 27 \n client.println(\"GPIO 27 - State \" + output27State + \"\");\n // If the output27State is off, it displays the ON button \n if (output27State==\"off\") {\n client.println(\"ON\");\n } else {\n client.println(\"OFF\");\n }\n client.println(\"\");\n \n // The HTTP response ends with another blank line\n client.println();\n // Break out of the while loop\n break;\n } else { // if you got a newline, then clear currentLine\n currentLine = \"\";\n }\n } else if (c != \'\\r\') { // if you got anything else but a carriage return characte \n currentLine += c; // add it to the end of the currentLine\n }\n }\n }\n // Clear the header variable\n header = \"\";\n // Close the connection\n client.stop();\n Serial.println(\"Client disconnected.\");\n Serial.println(\"\");\n }\n}\n\nalt text\n this is webserver page \n\n \n \n alt text\n circuit diagram \n\nimage\n\n\nimage\n\n\n\n### TASK-7\n# Karnaugh Maps and Deriving the logic circuit\n## \na diagram consisting of a rectangular array of squares each representing a different combination of the variables of a Boolean function\n\nA Karnaugh map (K-map) is a visual method used to simplify the algebraic expressions in Boolean functions without having to resort to complex theorems or equation manipulations.\n\nalt text\n\n## Burglar alarm system using AND gate :\nin this task we will be doing an burglar alarm system using logic gates.\nThe simulation will be done with the help of tinker cad\nThe alarm system is in such a way that when light falls on the LDR it will be sending signals to LEDandBuzzers\nwith the help of AND gate\n\n## COMPONENTS USED :\n1. BREAD BOARD \n2. LDR ()\n3. RESISTORS\n4. AND GATE (74HC08)\n5. LED LIGHT\n6. BUZZER\n\n## CIRCUIT :\nalt text\n\n\nimage\n\n\n\n\n\n\n### TASK-8\n# UBUNTU \n## \nThe objective of the task is that\n\n- to create a folder named test\n- CD into that folder\n- create a blank file without using any text editor\n- list the files in the particular folder\n- create 2600 folders in this folder each folder is named like A$1\n- concatenate two two text files in the folder containing random text and display them on the terminal.\n\n## To create a folder :\n- the command pwd is used he pwd command writes to standard output the full path name of your current directory (from the root directory)\n- *touch fileName – Create an empty file. cat > filename – To create a new text file under Ubuntu, use the cat command followed by the redirection symbol ( > ) and the name of the file you want to create. Press Enter, then type the text and once you are done, presUse \n- the mkdir command to create one or more directories specified by the Directory parameter.s the CRTL+D to save the file.\n\n\n## TO CREATE 2600 FOLDERS IN UBUNTU :\n- Use mkdir command\n- mkdir folder name\n- cd folder name\n- touch test_folder name\n- for i in {1..2600}\n- mkdir folder name $i\n- done\n## CONCATINATION OF TWO FILES :\n- touch text1.txt text2.txt\n- nano text1.text\n- A terminall will be open where we can type our txt\n\nexample- HELLO MY SELF ANJAL K NAIR \n- nano text2.txt\n- type second sentence\n\nexample-IAM MARVEL BATCH STUDENT \n\n\n\nimage\n\n\n\n\n\nimage\n\n\n\n\n\n\n"

UVCE,
K. R Circle,
Bengaluru 01