0% found this document useful (0 votes)
5 views3 pages

Code Bananas

This document contains an Arduino sketch for an automatic banana peeler using an ESP8266 microcontroller. It connects to a Wi-Fi network, sets up a web server, and controls a servo motor to peel bananas. The code includes HTML for a web interface displaying the number of bananas peeled and the device's IP address.

Uploaded by

simon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Code Bananas

This document contains an Arduino sketch for an automatic banana peeler using an ESP8266 microcontroller. It connects to a Wi-Fi network, sets up a web server, and controls a servo motor to peel bananas. The code includes HTML for a web interface displaying the number of bananas peeled and the device's IP address.

Uploaded by

simon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <ESP8266WiFi.

h>

#include <ESP8266WebServer.h>

#include <Servo.h>

#include <Wire.h>

const char* ssid ="moto"; // Enter SSID here

const char* password ="sinance264"; //Enter Password here

ESP8266WebServer server(80);

Servo myservo;

int motor = D2;

void setup() {

Wire.begin(SDA_PIN, SCL_PIN);

lcd.init();

lcd.backlight();

Serial.begin(115200);

delay(100);

Serial.println("Connecting to ");

Serial.println(ssid);

//connect to your local wi-fi network

WiFi.begin(ssid, password);

//check wi-fi is connected to wi-fi network

while (WiFi.status() != WL_CONNECTED) {

lcd.clear();

lcd.setCursor(0,0);

lcd.print("BANANA PEELING");

lcd.setCursor(0,1);
lcd.print("GROUP SIX");

delay(1000);

Serial.print(".");

Serial.println("");

Serial.println("WiFi connected..!");

Serial.print("Got IP: "); Serial.println(WiFi.localIP());

lcd.clear();

lcd.setCursor(0,0);

lcd.print(WiFi.localIP());

lcd.setCursor(0,1);

lcd.print("ENTER THIS IP");

server.begin();

Serial.println("HTTP server started");

delay(5000);

pinMode(motor, OUTPUT);

myservo.attach(D3);

void loop() {

digitalWrite(motor, HIGH);

delay(500);

myservo.write(0);

delay(5000);

myservo.write(180);

digitalWrite(motor,LOW);
delay(2000);

String ptr = "<!DOCTYPE html> <html>\n";

ptr += "<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-


scalable=no\">\n";

ptr += "<title>AUTOMATIC BANANA PEELER</title>\n";

ptr += "<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align:
center;}\n";

ptr += "body{margin-top: 50px;} h1 {color:#444444;margin: 50px auto 30px;}\n";

ptr += "p {font-size: 24px;color:#444444;margin-bottom: 10px;}\n";

ptr += "</style>\n";

ptr += "</head>\n";

ptr += "<body>\n";

ptr += "<div id=\"webpage\">\n";

ptr += "<h1>BANANA PEELER</h1>\n";

ptr += "<p>Bananas peeled: ";

ptr += (int)Number;

ptr += "°C</p>";

ptr +="</body>\n";

ptr +="</html>\n";

return;

You might also like