Shonie Caplan
Published © GPL3+

Improving work efficiency with Fitbit - #cloudgames

Program detects when user walks into office, and shows the user their predicted working efficiency based on Fitbit data collected that day.

AdvancedShowcase (no instructions)636
Improving work efficiency with Fitbit - #cloudgames

Things used in this project

Hardware components

Arduino Oplà IoT Kit
Arduino Oplà IoT Kit
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
18650 Battery
×1

Software apps and online services

Fitbit API
Arduino IoT Cloud
Arduino IoT Cloud
Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

Schematic

Code

The Code

Arduino
Program will fetch data from Fitbit if you put in your wifi ssid & pass, token, and user ID from Fitbit. Program will turn on light when user walks into their office, then show user their predicted work efficiency.
/*  
  ◦ ♥ ◦ ❀ ◦ ♥ ◦ |  S. Caplan & 4C Mech Official  | ◦ ♥ ◦ ❀ ◦ ♥ ◦
  ◦❀◦♡◦❀◦♡◦❀◦♡   |  𝕾. 𝕮𝖆𝖕𝖑𝖆𝖓 .ᵒᶠᶠ   |   ♡◦❀◦♡◦❀◦♡◦❀◦
⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄
A FISH IN SEA 🐟

By: Shonie Caplan
Contact: shonie4caplan@gmail.com
⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄
Arduino Cloud Games 2022 Project 
⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄
Program detects when user walks into their office, turns
on light and provides the user with predicted working efficiency 
based on data feteched from the Fitbit API. 

I'm using this everyday to collect more data and adjust values to
improve the accuracy of the program. The predicted work efficiency
is rough, but as I use 

Predictions are based on the user's sleep, physical activity and age.
(Nutrition, heartrate, burned calories, and user input will
be added in the future).

Efficiency will also be printed on Opla MKR Carrier in the future.
⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄
Thank you to the community helpers for helping me ◦ ❀ ◦ 
⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄
*/

#include <ArduinoHttpClient.h>
#include <SPI.h>
#include <WiFiNINA.h>
#include <RTCZero.h>

#include <ArduinoJson.h>
#include <ArduinoJson.hpp>

#include <Servo.h>


// Setup your SSID and password in the "Secret tab"
const char ssid[]     = SECRET_SSID;    // Network SSID (name)
const char pass[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

//⑄⑄ Servo Variables ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//Create Servo object
Servo servo;

//the number of times the calibration 'for' loop (1 sec each), cycles
int calibrationTime = 20;

//the time when the sensor outputs a low impulse
long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 5000;

boolean lockLow = true;
boolean takeLowTime;

//⑄⑄ Pin Variables ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
//int pirPin is the digital pin connected to the PIR sensor's output
const int pirPin = 3;

// the digital pin connected to the servo's input
const int servoPin = 7;
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡


//int 'val' reads PIR sensor pin; either 0 (OFF), or 1 (ON)
int val;

//int 'j' is to only run PIR calibration sequence a set amount of times
int j = 0;

//int 'k' is to only print ending bracket of PIR calibration sensor once
int k = 0;

//int 'valprev' is what val must be higher than, to increase 'i' (pir detection)
const int valprev = 0;

//int 'x' is to only run the 'if' delay 3 times
int x = 0;

//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡


//⑄⑄ Fitbit variables ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//Flag to send Json request once
int SendOnce = 0;

//TODO: Put your USER ID here
String userid = "";

//The location where we will be making the requests
String ApiTarget = "api.fitbit.com";

//Request Sending Booleans
bool req1 = false;   // First req is set true by PIR motion detection
bool req2 = false;
bool req3 = false;
bool req4 = false;
bool req5 = false;
bool req6 = false;

//Boolean to start calculating work efficiency, set true after all requests
bool mathQ = false;

//Age of user 
int age;

//Today's steps of user 
int steps;

//Locations in the endpoint for data
String ApiActivityTypes = "/1/activities.json";
String ApiActivityLifetimeStats = "/1/user/-/activities.json";

 
//TODO: put your access token here
String AccessToken = "";
String HeaderAccessToken = "Bearer " + AccessToken;
 
WiFiSSLClient wifi;
HttpClient client = HttpClient(wifi, ApiTarget, 443);
int status = WL_IDLE_STATUS;

//⑄⑄ RTC Code ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
RTCZero rtc;

/* Change these values to set the current initial time */
const int seconds = 0;
const int minutes = 36;
const int hours = 9;

/* Change these values to set the current initial date */
const int day = 16;
const int month = 3;
const int year = 22;
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡


//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  void setup() {  // ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  
  Serial.begin(9600);
    
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

//⑄⑄ Attach Pins ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  pinMode(pirPin, INPUT);
  digitalWrite(pirPin, LOW);

  servo.attach(servoPin);
  servo.write(90);
  delay(10); 
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
    
  Serial.print("Attempting to connect to Network named: ");
// Print the network name (SSID);
  Serial.println(ssid);
  while ( status != WL_CONNECTED) {
    
  // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);
  }
    
// Print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());
    
// Print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

// PIR sensor is active
  Serial.println("= = = = SENSOR ACTIVE = = = =");

// Start RTC
  rtc.begin(); // initialize RTC
  rtc.setTime(hours, minutes, seconds);
  rtc.setDate(day, month, year);
}
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// End of setup  ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡  
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡



//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  void loop() {   // ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//Detecting movement
  val = digitalRead(pirPin);  

  if (val > valprev) {
    
  //increase 'k' to turn on light
    k = k + 1;
    
    
  }
  
//⑄⑄ Light On ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

  if (k == 1) {
     
  //Turn Light on
    servo.write(130);
    delay(500);
    
  //Start requesting sequence
    req1 = true;
    
  //Turn back to middle position
    servo.write(90);
    delay(500);
    
    k = k + 1;
    


    //Embedded 'if'
    if (lockLow == true) {

      Serial.println( "---" );

      Serial.print( "motion detected at " );
      
      Serial.println("ON, Owen is a stick");
      
      Serial.print( millis() / 1000 );

      Serial.println( " sec" );
      
      //makes sure we wait for a transition to LOW before any further output is made:
      lockLow = false;
      
      delay(1500);
    }

    takeLowTime = true; // takeLowTime = true
    delay(5000); // delay so the sensor doesnt re-detect same object
  }


//⑄⑄ Light Off ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

  if (k == 3) {
    
    servo.write(60);
    delay(500);

    servo.write(90);
    delay(500);
      
      
      //Embedded 'if'
      if (takeLowTime) {
        //save the time of the transition from high to LOW
        lowIn = millis();

        //make sure this is only done at the start of a LOW phase
        takeLowTime = false;
      }

      //if the sensor is low for more than the given pause,
      //we assume that no more motion is going to happen
    if ( lockLow == false && millis() - lowIn > pause ) {

      //makes sure this block of code is only executed again after
      //a new motion sequence has been detected
      lockLow = true;

      Serial.print("motion ended at ");
      Serial.print((millis() - pause) / 1000);
      Serial.println(" sec");
      delay(50);
    }
      
      
      
      delay(5000); //delay so the sensor doesnt re-detect same object
      
      //set int 'i' back to 0
      k = 0;
    }

//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// String Builder ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄ Getting date to build string ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  int dd = rtc.getDay();      // Get current date & store as int
  int mm = rtc.getMonth();    // Get current month & store as int
  int yy = rtc.getYear();     // Get current year & store as int
  
//⑄⑄ Building parts of string ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String pt1 = "/1/user/";    // Start of request
  String pt2 = "/1.2/user/";  // Start of request (some reqs use different start)
  String dash = "-";
  String endpt = ".json";     // End part of request
  String yypt1 = "20";        // Put in front of 'yy' to make yyyy (Change to '21' in 2100)

//⑄⑄ Specific parts ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String sleepSTR = "/sleep/date/";
  String activitySTR = "/activities/date/";
  String ageSTR = "/profile/age";
  String stepsSTR = "/activities/steps/date/today/1d/15min";
  String calsSTR = "/activities/calories/date/today/1d/15min";
  String heartSTR = "/activities/heart/date/today/1d/1min";
  
  String prevsleepSTR = "/sleep/list.json?afterDate=2021-07-27&sort=desc&offset=0&limit=1";
  
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
//⑄⑄ Building Strings ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄ Sleep data from today ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String ApiSleep = pt2 + userid + sleepSTR + yypt1 + yy + dash + mm + dash + dd + endpt;

//⑄⑄ Intraday Step data ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String ApiStep = pt1 + userid + stepsSTR + endpt;

//⑄⑄ Age data ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡  
  String ApiAge = pt1 + userid + ageSTR + endpt;
   
//⑄⑄ Intraday Calorie data ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String ApiCal = pt1 + userid + calsSTR + endpt;

//⑄⑄ Intraday Heart Rate data ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  String ApiHeart = pt1 + userid + heartSTR + endpt;
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
    
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

  
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// Requesting Data ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ 
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡    

//⑄⑄ Send Sleep request ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  if (req1 == true) {    // To only send once

    client.beginRequest();
    client.get(ApiSleep);
    client.sendHeader("accept", "application/json");
    client.sendHeader("authorization", HeaderAccessToken);
    client.endRequest();
 
  // Read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String sleepRES = client.responseBody();
    
    DynamicJsonDocument doc(6144);  
    
  // Deserialize the JSON document
    DeserializationError error = deserializeJson(doc, sleepRES);
  
  // Test if parsing succeeds.
  if (error) {
    Serial.print(F("deserializeJson() failed: "));
    Serial.println(error.f_str());
    return;
  }
  
    JsonObject sleepdoc = doc["sleep"][0];
  
  // Sleep duration in seconds
    long sleepDuration = sleepdoc["duration"];
    
  // Sleep efficiency out of 100
    int sleepEfficiency = sleepdoc["efficiency"];

    // Serial.println(sleepEfficiency);

    // Serial.print("GET Status code: ");
    // Serial.println(statusCode);
    // Serial.print("GET Response: ");
    // Serial.println(sleepRES);
 
    delay(3000);
    
  // Get out of Sleep Request loop
    req1 = false;
    
  // Set 2nd loop Flag to true
    req2 = true;
  }
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  
//⑄⑄ Send Step request ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  if (req2 == true) {    // To only send once

    client.beginRequest();
    client.get(ApiStep);
    client.sendHeader("accept", "application/json");
    client.sendHeader("authorization", HeaderAccessToken);
    client.endRequest();
 
  // Read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String stepRES = client.responseBody();
 
    DynamicJsonDocument doc(6144);

    DeserializationError error = deserializeJson(doc, stepRES);

  if (error) {
    Serial.print("deserializeJson() failed: ");
    Serial.println(error.c_str());
    return;
  }

    steps = doc["activities-steps"][0]["value"]; // "241"
 
    // Serial.print("GET Status code: ");
    // Serial.println(statusCode);
    // Serial.print("GET Response: ");
    // Serial.println(steps);
 
    delay(3000);
    
  // Get out of Step Request loop
    req2 = false;
    
  // Set 5th loop Flag to true
    req3 = true;
  }
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄ Send Age request ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  if (req3 == true) {    // To only send once

    client.beginRequest();
    client.get(ApiAge);
    client.sendHeader("accept", "application/json");
    client.sendHeader("authorization", HeaderAccessToken);
    client.endRequest();
 
  // Read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String ageRES = client.responseBody();
 
    DynamicJsonDocument agedoc(8192);

  // Deserialize the JSON document
    DeserializationError agejs = deserializeJson(agedoc, ageRES);
  
  // Test if parsing succeeds.
  if (agejs) {
    Serial.print(F("deserializeJson() failed: "));
    Serial.println(agejs.f_str());
    return;
  }
  
   
  JsonObject user = agedoc["user"];
  age = user["age"]; 
    
    // Serial.print("GET Status code: ");
    // Serial.println(statusCode);
    // Serial.print("GET Response: ");
    // Serial.println(age);
 
    delay(3000);
    
  // Get out of Age Request loop
    req3 = false;
    
  // Set 4th loop Flag to true
    req4 = true;
  }
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄ Send Calorie request ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  if (req4 == true) {    // To only send once

    client.beginRequest();
    client.get(ApiCal);
    client.sendHeader("accept", "application/json");
    client.sendHeader("authorization", HeaderAccessToken);
    client.endRequest();
 
  // Read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String calRES = client.responseBody();
 
    // Serial.print("GET Status code: ");
    // Serial.println(statusCode);
    // Serial.print("GET Response: ");
    // Serial.println(calRES);
 
    delay(3000);
    
  // Get out of Calorie Request loop
    req4 = false;
    
  // Set 5th loop Flag to true
    req5 = true;
  }
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄ Send Heart Rate request ⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
  if (req5 == true) {    // To only send once

    client.beginRequest();
    client.get(ApiHeart);
    client.sendHeader("accept", "application/json");
    client.sendHeader("authorization", HeaderAccessToken);
    client.endRequest();
 
  // Read the status code and body of the response
    int statusCode = client.responseStatusCode();
    String heartRES = client.responseBody();
 
    // Serial.print("GET Status code: ");
    // Serial.println(statusCode);
    // Serial.print("GET Response: ");
    // Serial.println(heartRES);
 
    delay(3000);
    
  // Get out of Heart Rate Request loop
    req6 = false;
    
  // Start parsing json files
    mathQ = true;
  }
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// Predicting Efficiency (Math Section) ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

/*
Age	                 Steps: Minimum	     Steps: Active	 Steps: Highly Active
4-6   years old	        6,000 steps	      10,000 steps   	  14,500 steps
6-11  years old (female)6,500 steps	      11,000 steps	    13,500 steps
6-11  years old (male)	7,000 steps	      13,000 steps   	  15,500 steps
12-19 years old	        6,500 steps	      10,000 steps   	  12,500 steps
20-65 years old	        4,000 steps	      7,000  steps	    11,500 steps
65+   years old	        3,000 steps	      7,000  steps  	  10,500 steps 
*/
int DaySteps;

  if (mathQ == true) {
    
    
    if (age > 0) {
      
      
      if (age < 6 && age > 4 || age <= 19 && age >= 12) {
        DaySteps = 6500;
        
      } else if (age < 4) {
        Serial.println("User is too young!");
        
      } else if (age > 6) {
          
          if (age >= 6 && age <= 11) {
            DaySteps = 7000;
            
          } else if (age > 11) {
            
            if (age > 19 && age <= 65) {
              DaySteps = 4000;
              
            } else if (age > 65) {
              DaySteps = 3000;
              
            }
          }
      }
      
    } else {
      
      Serial.println("User must be at least 4 years old");
      mathQ = false;
    }
    
    int stepcomp = (DaySteps - steps)
    
    if (stepcomp > 0) {
      Serial.println("Consider taking a walk to increase work efficiency and feel better");
      
    } else if (stepcomp < 0) {
      Serial.println("Good job! You have surpassed the steps threshold for your age, you are in good condition to work");
    }
    
    Serial.println("Your sleep efficieny last night was: " + sleepEfficiency);
    
    if (sleepEfficiency >= 50) {
      
        if (sleepEfficiency <= 75) {
          Serial.println("You had okay last night, but a short nap will still improve your productivity");

        } else if (sleepEfficiency > 75) {
          Serial.println("You had great sleep last night, you should be in great condition to work!");
        }
    } else if (sleepEfficiency < 50) {
      Serial.println("You did't have a great sleep last night, consider taking a 20 minute nap, this will help your working efficiency a lot");
    }
    
  
  } 
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
// ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡


}
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡
//  End of loop  ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡ ◦ ♡  
//⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄⑄♡

/*
  Since AvgSleepWeek is READ_WRITE variable, onAvgSleepWeekChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onAvgSleepWeekChange()  {
  // Add your code here to act upon AvgSleepWeek change
}

/*
  Since LightState is READ_WRITE variable, onLightStateChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onLightStateChange()  {
  // Add your code here to act upon LightState change
}

Credits

Shonie Caplan
0 projects • 0 followers

Comments