Hi,
I have been working with my Opla kit for a month or so now and whatever I do, I can't seem to get the display to actually show any data. It seems to light up from black to illuminated but that is it. Because of this, I am assuming it is my error.
I would appreciate if you could review my code and provide any insights that i'm missing.
// Arduino_MKRIoTCarrier - Version: Latest
#include <AirQualityClass.h>
#include <Arduino_MKRIoTCarrier.h>
#include <Arduino_MKRIoTCarrier_Buzzer.h>
#include <Arduino_MKRIoTCarrier_Qtouch.h>
#include <Arduino_MKRIoTCarrier_Relay.h>
#include <EnvClass.h>
#include <IMUClass.h>
#include <MKRIoTCarrierDefines.h>
#include <PressureClass.h>
#include "thingProperties.h"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
int moistPin;
uint32_t lightsOn = carrier.leds.Color(82, 118, 115);
uint32_t lightsOff = carrier.leds.Color(0, 0, 0);
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
//Get Cloud Info/errors , 0 (only errors) up to 4
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Wait to get cloud connection to init the carrier
while (ArduinoCloud.connected() != 1) {
ArduinoCloud.update();
delay(500);
}
delay(500);
CARRIER_CASE = true;
carrier.begin();
moistPin = carrier.getBoardRevision() == 1 ? A5 : A0; //assign A0 or A5 based on HW revision
carrier.display.setRotation(0);
delay(1500);
}
void loop() {
//Update the Cloud
ArduinoCloud.update();
//read temperature and humidity
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
//read raw moisture value
int raw_moisture = analogRead(moistPin);
//map raw moisture to a scale of 0 - 100
moisture = map(raw_moisture, 0, 1023, 100, 0);
//read ambient light
while (!carrier.Light.colorAvailable()) {
delay(5);
}
int none; //We dont need RGB colors
carrier.Light.readColor(none, none, none, light);
delay(100);
}
//Update displayed Info
void updateScreen() {
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(3);
carrier.display.setCursor(40, 50);
carrier.display.print(temperature);
carrier.display.setCursor(40, 90);
carrier.display.print(humidity);
carrier.display.setCursor(40, 130);
carrier.display.print(moisture);
}
/*
Any help would be appreciated.