Hardware components | ||||||
| × | 1 | ||||
![]() |
| × | 1 | |||
Software apps and online services | ||||||
![]() |
| |||||
![]() |
|
I've always thought that there weren't many tutorials for MKR Carrier Rev2. That's why I decided to just write my own operating system for it! I hope you all like it!
There are several things to know:
Although the display is always on, only text is shown when the top button (02) is pressed. With the keys 01 and 03 you can switch between the different pages or dashboards. On the one hand there is "Weather" which you can enter by pressing the 04 key. You then see the temperature and humidity. You can exit by pressing either button 02 or 04. The settings dashboard is accessed using the same principle. If you want to switch the LEDs on or off, you have to press the 00 key.
But hopefully it's easy to use anyway and there shouldn't be too many problems. If there are any, feel free to write them in the comments!
Updates01.04.2023
Today there is an important new function:
- Replace dashboard with time + date
- Connect to WiFi (must be configured)
- Gradient home screen
Problems:
- When starting, it is necessary to press the 02 button, then wait until the next minute, and only then it will show the time
- The same applies if you want to go to the dashboard from another page.
If you have any questions, suggestions or requests, feel free to write them in the comments! What other feature would you like?
26.03.2023
New features are here!
25.03.2023
Our project is online after a long work! But there will always be updates to make it better and better! At the moment you can display temperature and humidity, but there may be more to come soon. I would appreciate a like and a comment on how you like it and what can be improved!
In the "Settings" section, the LED light can now also be switched on by pressing button 0 (Arduino MKR IoT Carrier Rev2). Then it is white!
#include <WiFiNINA.h>
#include <Arduino_MKRIoTCarrier.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#include <TimeLib.h> // Include the TimeLib library
#include <FastLED.h>
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
MKRIoTCarrier carrier;
float temperature = 0;
float humidity = 0;
unsigned long lastTempUpdate = 0;
int currentPage = 0;
bool inSubMenu = false;
int subMenuPage = 0;
bool ledState = false;
int brightness = -10;
void printDashboard() {
timeClient.update();
if (timeClient.getSeconds() == 0 || timeClient.getSeconds() == 30) { // Check if a full minute or a full half minute has been reached
String formattedTime = timeClient.getFormattedTime().substring(0, 5); // Get the formatted time string and keep only the hours and minutes
setTime(timeClient.getEpochTime()); // Set the internal time using the epoch time from the NTP client
String formattedDate = String(day()) + "." + String(month()) + "." + String(year()); // Get the formatted date string using the TimeLib functions
int16_t x1, y1, x2, y2;
uint16_t w1, h1, w2, h2;
uint16_t width = carrier.display.width();
uint16_t height = carrier.display.height();
for (int y = 0; y < height; y++) {
uint8_t r = map(y, 0, height-1, 255, 0);
uint8_t g = 0;
uint8_t b = map(y, 0, height-1, 0, 255);
carrier.display.drawFastHLine(0, y, width, carrier.display.color565(r, g, b));
}
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
carrier.display.getTextBounds(formattedDate, 0, 0, &x1, &y1, &w1, &h1); // Get the bounds of the date text
carrier.display.getTextBounds(formattedTime, 0, 0, &x2, &y2, &w2, &h2); // Get the bounds of the time text
x1 = (carrier.display.width() - w1) / 2; // Calculate the X position to center the date text
y1 = (carrier.display.height() - h1 - h2 - h2) / 2; // Calculate the Y position to place the date text above the time text and the empty line
x2 = (carrier.display.width() - w2) / 2; // Calculate the X position to center the time text
y2 = y1 + h1 + h2; // Calculate the Y position to place the time text below the date text and the empty line
carrier.display.setCursor(x1, y1); // Set cursor position for the date text
carrier.display.println(formattedDate); // Print the date text
carrier.display.println(); // Print an empty line
carrier.display.setCursor(x2, y2); // Set cursor position for the time text
carrier.display.println(formattedTime); // Print the time text
}
}
void printTemperature() {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String tempStr = "Temp: " + String(temperature) + " C";
carrier.display.getTextBounds(tempStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(tempStr);
}
void printHumidity() {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String humidityStr = "Humidity: " + String(humidity) + " %";
carrier.display.getTextBounds(humidityStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(humidityStr);
}
void printWeather() {
carrier.display.fillScreen(ST77XX_YELLOW);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("Weather", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("Weather");
}
void printSettings() {
carrier.display.fillScreen(ST77XX_MAGENTA);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("Settings", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("Settings");
}
void printLight() {
carrier.display.fillScreen(ST77XX_ORANGE);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String text = "LED: ";
// Check if button 0 is pressed
if (digitalRead(0) == HIGH) {
// Increase brightness by 10% until it reaches 100%
brightness += 10;
if (brightness > 100) {
// Reset brightness to 0%
brightness = 0;
ledState = false;
} else {
ledState = true;
}
} else {
ledState = false; // Turn off the LED if button 0 is not pressed
}
if (ledState) {
text += "ON";
} else {
text += "OFF";
}
carrier.display.getTextBounds(text, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(text);
if (ledState) {
// Set the LED brightness according to the global variable
carrier.leds.fill(CRGB::White);
carrier.leds.setBrightness(brightness);
carrier.leds.show();
} else {
// Set the LED color to black
carrier.leds.fill(CRGB::Black);
carrier.leds.show();
}
}
void setup() {
// Start sound
carrier.Buzzer.sound(523);
delay(200);
carrier.Buzzer.sound(659);
delay(200);
carrier.Buzzer.sound(784);
delay(200);
carrier.Buzzer.sound(880);
delay(200);
carrier.Buzzer.sound(1047);
delay(600);
carrier.Buzzer.noSound();
CARRIER_CASE = false;
carrier.begin();
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
carrier.display.setRotation(0);
const char* ssid = "";
const char* password = "";
// Serial.begin(9600);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextSize(2);
// Connect to Wi-Fi network with SSID and password
// Serial.print("Connecting to ");
// Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
// Serial.println("Connecting to WiFi...");
}
timeClient.begin();
// Set time offset to your local timezone in seconds
timeClient.setTimeOffset(7200);
}
void loop() {
timeClient.update();
printDashboard();
if (carrier.Buttons.onTouchDown(TOUCH0)) {
if (inSubMenu && currentPage == 2 && subMenuPage == 0) {
ledState = !ledState;
printLight();
}
else if (currentPage == 2) {
inSubMenu = true;
subMenuPage = 0;
printLight();
}
}
carrier.Buttons.update();
unsigned long now = millis();
if(now - lastTempUpdate > 60000){
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
lastTempUpdate = now;
}
if (carrier.Buttons.onTouchDown(TOUCH2)) {
currentPage = 0;
inSubMenu = false;
printDashboard();
}
else if (carrier.Buttons.onTouchDown(TOUCH1) || carrier.Buttons.onTouchDown(TOUCH3)) {
if (!inSubMenu) {
currentPage = (currentPage + 1) % 4;
switch(currentPage) {
case 0:
printDashboard();
break;
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
else {
subMenuPage = (subMenuPage + 1) % 2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperature();
break;
case 1:
printHumidity();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
}
else if (carrier.Buttons.onTouchDown(TOUCH4)) {
if ((currentPage == 1 || currentPage ==2) && !inSubMenu) {
inSubMenu = true;
subMenuPage = (subMenuPage + 1) %2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperature();
break;
case 1:
printHumidity();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
else if (inSubMenu) {
inSubMenu = false;
switch(currentPage) {
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
}}
#include <WiFiNINA.h>
#include <Arduino_MKRIoTCarrier.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#include <TimeLib.h> // Include the TimeLib library
#include <FastLED.h>
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
MKRIoTCarrier carrier;
float temperature = 0;
float humidity = 0;
unsigned long lastTempUpdate = 0;
int currentPage = 0;
bool inSubMenu = false;
int subMenuPage = 0;
bool ledState = false;
int brightness = -10;
void printDashboard() {
timeClient.update();
if (timeClient.getSeconds() == 0 || timeClient.getSeconds() == 30) { // Check if a full minute or a full half minute has been reached
String formattedTime = timeClient.getFormattedTime().substring(0, 5); // Get the formatted time string and keep only the hours and minutes
setTime(timeClient.getEpochTime()); // Set the internal time using the epoch time from the NTP client
String formattedDate = String(day()) + "." + String(month()) + "." + String(year()); // Get the formatted date string using the TimeLib functions
int16_t x1, y1, x2, y2;
uint16_t w1, h1, w2, h2;
uint16_t width = carrier.display.width();
uint16_t height = carrier.display.height();
for (int y = 0; y < height; y++) {
uint8_t r = map(y, 0, height-1, 255, 0);
uint8_t g = 0;
uint8_t b = map(y, 0, height-1, 0, 255);
carrier.display.drawFastHLine(0, y, width, carrier.display.color565(r, g, b));
}
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
carrier.display.getTextBounds(formattedDate, 0, 0, &x1, &y1, &w1, &h1); // Get the bounds of the date text
carrier.display.getTextBounds(formattedTime, 0, 0, &x2, &y2, &w2, &h2); // Get the bounds of the time text
x1 = (carrier.display.width() - w1) / 2; // Calculate the X position to center the date text
y1 = (carrier.display.height() - h1 - h2 - h2) / 2; // Calculate the Y position to place the date text above the time text and the empty line
x2 = (carrier.display.width() - w2) / 2; // Calculate the X position to center the time text
y2 = y1 + h1 + h2; // Calculate the Y position to place the time text below the date text and the empty line
carrier.display.setCursor(x1, y1); // Set cursor position for the date text
carrier.display.println(formattedDate); // Print the date text
carrier.display.println(); // Print an empty line
carrier.display.setCursor(x2, y2); // Set cursor position for the time text
carrier.display.println(formattedTime); // Print the time text
}
}
void printTemperature() {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String tempStr = "Temp: " + String(temperature) + " C";
carrier.display.getTextBounds(tempStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(tempStr);
}
void printHumidity() {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String humidityStr = "Humidity: " + String(humidity) + " %";
carrier.display.getTextBounds(humidityStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(humidityStr);
}
void printWeather() {
carrier.display.fillScreen(ST77XX_YELLOW);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("Weather", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("Weather");
}
void printSettings() {
carrier.display.fillScreen(ST77XX_MAGENTA);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("Settings", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("Settings");
}
void printLight() {
carrier.display.fillScreen(ST77XX_ORANGE);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String text = "LED: ";
// Check if button 0 is pressed
if (digitalRead(0) == HIGH) {
// Increase brightness by 10% until it reaches 100%
brightness += 10;
if (brightness > 100) {
// Reset brightness to 0%
brightness = 0;
ledState = false;
} else {
ledState = true;
}
} else {
ledState = false; // Turn off the LED if button 0 is not pressed
}
if (ledState) {
text += "ON";
} else {
text += "OFF";
}
carrier.display.getTextBounds(text, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(text);
if (ledState) {
// Set the LED brightness according to the global variable
carrier.leds.fill(CRGB::White);
carrier.leds.setBrightness(brightness);
carrier.leds.show();
} else {
// Set the LED color to black
carrier.leds.fill(CRGB::Black);
carrier.leds.show();
}
}
void setup() {
// Start sound
carrier.Buzzer.sound(523);
delay(200);
carrier.Buzzer.sound(659);
delay(200);
carrier.Buzzer.sound(784);
delay(200);
carrier.Buzzer.sound(880);
delay(200);
carrier.Buzzer.sound(1047);
delay(600);
carrier.Buzzer.noSound();
CARRIER_CASE = false;
carrier.begin();
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
carrier.display.setRotation(0);
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
// Serial.begin(9600);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextSize(2);
// Connect to Wi-Fi network with SSID and password
// Serial.print("Connecting to ");
// Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
// Serial.println("Connecting to WiFi...");
}
timeClient.begin();
// Set time offset to your local timezone in seconds
timeClient.setTimeOffset(7200);
}
void loop() {
timeClient.update();
printDashboard();
if (carrier.Buttons.onTouchDown(TOUCH0)) {
if (inSubMenu && currentPage == 2 && subMenuPage == 0) {
ledState = !ledState;
printLight();
}
else if (currentPage == 2) {
inSubMenu = true;
subMenuPage = 0;
printLight();
}
}
carrier.Buttons.update();
unsigned long now = millis();
if(now - lastTempUpdate > 60000){
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
lastTempUpdate = now;
}
if (carrier.Buttons.onTouchDown(TOUCH2)) {
currentPage = 0;
inSubMenu = false;
printDashboard();
}
else if (carrier.Buttons.onTouchDown(TOUCH1) || carrier.Buttons.onTouchDown(TOUCH3)) {
if (!inSubMenu) {
currentPage = (currentPage + 1) % 4;
switch(currentPage) {
case 0:
printDashboard();
break;
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
else {
subMenuPage = (subMenuPage + 1) % 2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperature();
break;
case 1:
printHumidity();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
}
else if (carrier.Buttons.onTouchDown(TOUCH4)) {
if ((currentPage == 1 || currentPage ==2) && !inSubMenu) {
inSubMenu = true;
subMenuPage = (subMenuPage + 1) %2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperature();
break;
case 1:
printHumidity();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
else if (inSubMenu) {
inSubMenu = false;
switch(currentPage) {
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
}}
#include <Arduino_MKRIoTCarrier.h>
#include <FastLED.h>
MKRIoTCarrier carrier;
float temperature = 0;
float humidity = 0;
unsigned long lastTempUpdate = 0;
int currentPage = 0;
bool inSubMenu = false;
int subMenuPage = 0;
bool ledState = false;
void printDashboard() {
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("SCHAECHNER", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("SCHAECHNER");
}
void printTemperature() {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String tempStr = "Temp: " + String(temperature) + " C";
carrier.display.getTextBounds(tempStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(tempStr);
}
void printHumidity() {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String humidityStr = "Humidity: " + String(humidity) + " %";
carrier.display.getTextBounds(humidityStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(humidityStr);
}
void printWeather() {
carrier.display.fillScreen(ST77XX_YELLOW);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("WEATHER", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("WEATHER");
}
void printTemperatureSubMenu() {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String tempStr = "Temp: " + String(temperature) + " C";
carrier.display.getTextBounds(tempStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(tempStr);
}
void printHumiditySubMenu() {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String humidityStr = "Humidity: " + String(humidity) + " %";
carrier.display.getTextBounds(humidityStr, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(humidityStr);
}
void printSettings() {
carrier.display.fillScreen(ST77XX_MAGENTA);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
carrier.display.getTextBounds("Settings", 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print("Settings");
}
void printLight() {
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
int16_t x, y;
uint16_t width, height;
String text = "LED: ";
if (ledState) {
text += "ON";
} else {
text += "OFF";
}
carrier.display.getTextBounds(text, 0, 0, &x, &y, &width, &height);
carrier.display.setCursor((carrier.display.width() - width) / 2, (carrier.display.height() - height) / 2);
carrier.display.print(text);
if (ledState) {
carrier.leds.fill(CRGB::White);
carrier.leds.show();
} else {
carrier.leds.fill(CRGB::Black);
carrier.leds.show();
}
}
void setup() {
CARRIER_CASE = false;
carrier.begin();
carrier.display.setRotation(0);
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
}
void loop() {
if (carrier.Buttons.onTouchDown(TOUCH0)) {
if (inSubMenu && currentPage == 2 && subMenuPage == 0) {
ledState = !ledState;
printLight();
}
else if (currentPage == 2) {
inSubMenu = true;
subMenuPage = 0;
printLight();
}
}
carrier.Buttons.update();
unsigned long now = millis();
if(now - lastTempUpdate > 60000){
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
lastTempUpdate = now;
}
if (carrier.Buttons.onTouchDown(TOUCH2)) {
currentPage = 0;
inSubMenu = false;
printDashboard();
}
else if (carrier.Buttons.onTouchDown(TOUCH1) || carrier.Buttons.onTouchDown(TOUCH3)) {
if (!inSubMenu) {
currentPage = (currentPage + 1) % 4;
switch(currentPage) {
case 0:
printDashboard();
break;
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
else {
subMenuPage = (subMenuPage + 1) % 2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperatureSubMenu();
break;
case 1:
printHumiditySubMenu();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
}
else if (carrier.Buttons.onTouchDown(TOUCH4)) {
if ((currentPage == 1 || currentPage ==2) && !inSubMenu) {
inSubMenu = true;
subMenuPage = (subMenuPage + 1) %2;
switch(currentPage) {
case 1:
switch(subMenuPage) {
case 0:
printTemperatureSubMenu();
break;
case 1:
printHumiditySubMenu();
break;
}
break;
case 2:
switch(subMenuPage) {
case 0:
printLight();
break;
case 1:
printTemperature();
break;
}
break;
}
}
else if (inSubMenu) {
inSubMenu = false;
switch(currentPage) {
case 1:
printWeather();
break;
case 2:
printSettings();
break;
}
}
}}
Comments
Please log in or sign up to comment.