top of page
Search

5/12-5/16

  • Writer: Kimberly Dao
    Kimberly Dao
  • May 15
  • 3 min read

This week I was focused on finishing up the webserver code and customizing. My goal this week was to finish up the webpage and the webserver code. Last week, I had previously finished decorating the web page but I didn't show it in my last blog post because of the map project Mr. Christy gave me. Bella, Jaspreet, and I were able to finish the map and that map is projected in the main office.

Last Friday, I simply edited the html code and created four new buttons and renamed them to the four seasons. I also coded in to make where if you press a number then it will show up on the top of the web page so then you'd know which season has been selected. These changes allowed the webpage to look finished in my eyes but I will add more buttons for special occasions such as Christmas or Valentines day.

HTML Code change

<!DOCTYPE html>
<html>
<head>
  <title>ESP32 Web Server</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" href="data:,">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <h1>Giant Word Clock Colors</h1>
  <p>Selected Color: <strong> %SEASONS%</strong></p>
  <p><a href="/Spring"><button class="button">Spring</button></a></p>
  <p><a href="/Summer"><button class="button button2">Summer</button></a></p>
  <p><a href="/Fall"><button class="button button2 button3">Fall</button></a></p>
  <p><a href="/Winter"><button class="button button2 button3 button4">Winter</button></a></p>
</body>
</html>

ree

On Monday, I retouched on the webserver code and decided to work on figuring out the daylight saving code. Mr. Christy sent me his code that he made for his typewriter and so I used it. However, I had to switch to the NTPClient in order to grab time and also the months and days. I found a website that provided me code to use, this code allowed me to already use the months provided while the other time code I had did not.

NTPClient Code

 time_t epochTime = timeClient.getEpochTime();
  Serial.print("Epoch Time: ");
  Serial.println(epochTime);

  int currentHour = timeClient.getHours();
  Serial.print("Hour: ");
  Serial.println(currentHour);

  int currentMinute = timeClient.getMinutes();
  Serial.print("Minutes: ");
  Serial.println(currentMinute);

  int currentSecond = timeClient.getSeconds();
  Serial.print("Seconds: ");
  Serial.println(currentSecond);

  String weekDay = weekDays[timeClient.getDay()];
  Serial.print("Week Day: ");
  Serial.println(weekDay);

  //Get a time structure
  struct tm *ptm = gmtime((time_t *)&epochTime);

  int monthDay = ptm->tm_mday;
  Serial.print("Month day: ");
  Serial.println(monthDay);

  int currentMonth = ptm->tm_mon + 1;
  Serial.print("Month: ");
  Serial.println(currentMonth);


  String currentMonthName = months[currentMonth - 1];
  Serial.print("Month name: ");
  Serial.println(currentMonthName);

  int currentYear = ptm->tm_year + 1900;
  Serial.print("Year: ");
  Serial.println(currentYear);

  //Print complete date:
  String currentDate = String(currentYear) + "-" + String(currentMonth) + "-" + String(monthDay);
  Serial.print("Current date: ");
  Serial.println(currentDate);

For the rest of the week except for Thursday I continued to work on the webserver code and while trying to combine the webserver and world clock code. Mr. Christy and I realized that the webserver cannot handle powering for name 70 LEDS. The world clock has 90 LEDs so that wont be very helpful. We also had a lot of trouble with uploading and had to use COM19 Dev Mod. a lot of times because of the issue. However, I now understand it is not the code that is breaking it and instead the esp32 itself.

Before we knew that, Mr. Christy asked me to create two separate boards so then I could test the word clock code freely and also have the esp32 control the board and be tested on the word clock. We had also thought it was a power issue with the board. While on Thursday, Mr. Christy gave me a code break and gave me some cleaning tasks as the end of the school year approaches.


ree

If you are interested in the webserver's code at the moment: https://github.com/KimmyDao/World-Clock-Webserver/blob/main/webcontrol/webcontrol.ino

 
 
 

Recent Posts

See All

Comments


Kim's Circle

bottom of page