Buongiorno, metto le mani avanti dicendo che è la prima volta che uso Arduino (ho esperienza in PIC e plc).
Il programma, quando collegato al PC funziona tranquillamente. Ma nel momento che lo stacco ed alimento Arduino da una fonte esterna, si accende ma non parte. Mi accorgo che il programma non gira perché ho un display i2c e sul setup faccio visualizzare "welcome" che però quando non attaccato alla USB non appare.
Avete consigli? Forse devo disattivare la seriale se non utilizzata?
Allego parte iniziale del programma:
#include "thingProperties.h"
#include <Arduino_MKRTHERM.h>
#include <Wire.h>
#include <SPI.h>
#include <LCD_I2C.h>
LCD_I2C lcd(0x27, 16, 2); // Default addres his of most PCF8574 modules, change according
float ph_calibration = 21.34;
float cl_calibration = 21.34;
float ph_act = 0.0;
float redox_act = 0.0;
float cl_act = 0.0;
float temp_act = 0.0;
unsigned long int avgval;
int buffer_arr[10], temp;
int Aport = 0;
int Error = 0;
int MatriceRedox [7][21];
float arrayPh [7];
float arrayCl [21];
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);
while (!Serial);
if (!THERM.begin()) {
Serial.println("Failed to initialize MKR THERM shield!");
while (1);
}
//
//lcd.init();
lcd.begin();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Welcome to ");
lcd.setCursor(0, 1);
lcd.print(" PH&Cl control ");
delay(500);
lcd.clear();
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}