Skip to content

Latest commit

 

History

History
102 lines (89 loc) · 3.08 KB

README.md

File metadata and controls

102 lines (89 loc) · 3.08 KB

LCD-data-getter software

Simple software to comunicate with your arduino board, send time, date and weather forecast. This repository only works with the LCD-clock project, you can find it here.


About The Project

View Demo

There are a lot of modern digital clocks available on the internet or in physical store, even good-looking ones. Though I've decided to create this software to comunicate with my arduino board and learn-by-doing how everything works with embedd softwares. This software is by no means complete AND/OR indicated for professional use, it has to be considered as amateur project, hobbist software.

How does everything work?

Basically, when the board is connected through USB to the computer, it "awaits" for data. It means that the arduino board sends (through serial communication) <weather> string to the software, the software "reads" and gets the weather data through LAT and LOG of your location, which it would be hard coded in the software. The weather forecast is gathered through an API call to https://openweathermap.org/ every ten minutes using the CURL library. Once the weather data is stored in Arduino, the board will keep communicating to the software <time> string every second and will receive time and date to display on the LCD. It'll be possible to display the weather pressing a button.

Docs

class Reader

string request(string request)

Returns a string. Example:

string response = read.request("<time>");
cout << response << endl;
// Output: 08/01/2024 12:00:00

class Writer

bool write(SimpleSerial* serial, string message)

returns a boolean. Example:

bool write = write.write(&Serial, "08/01/2024 12:00:00");
if(write == false {
  cout << "Impossible to write to the board" << endl;
}
else {
  cout << "Message sent" << endl;
}

class Time

string getTime()

returns day/month/year hour:minutes:seconds Example:

void printSysTimeAndDate() {
  Time time;
  return time.getTime()
}

// Output: 08/01/2024 12:00:00

class Weather

string getWeather()

returns temperatures in celsius and current weather in Italian. Example:

string response = read.request("<weather>");
cout << response << endl;
// Output: 10C Soleggiato
int KtoC(double kelvin)

Converts Kelvin to Celsius. It's needed because https://openweathermap.org/ returns temperatures in Kelvin. Returns: Celsius.

const int C = KtoC(303.15)
cout << C << endl;
//Output: 30
// Absolute zero: 273,15. 303 K - 273,15 = 30 °C```

```cpp
string translate(string condition)

returns the translated weather conditions. example:

const translateRain = translate("Rain);
cout << translateRain << endl;
//Output: pioggia