MKR IoT Carrier not working

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.

Try these steps:

  1. Use IDE 2 and make sure that you install all the dependencies that shows up after the installation. If your machine is running Windows 11, check How to Fix Arduino Problem on Windows 11 and grant the IDE admin right.

  2. Install your board's (eg Arduino MKR WiFi 1010) Package Core, it contains the board's driver.

  3. Install MKR IoT Carrier's library via the library manager of the IDE (check Add libraries to Arduino IDE). Note: Try different versions of the library, starting with the latest version to see which one works for you.

  4. Make sure you select the board and the port it is connected to before uploading a sketch. Run Arduino_MKRIoTCarrier Display examples from the IDE examples to check.

1 Like

Great, thank you.

I have gotten the screen working now.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.