Hello,
Arduino noob here, and I recently started having some weird stuff happen with my nano. Long story short, I put together some mqtt data transfer to a broker, and initially everything acted as I expected, but as I added more soil sensors, I started getting some strange serial messages, and I'm wondering if someone can help me make sense of them.
//wifi stuff
#include <WiFi.h>
const char* ssid = "";
const char* password = "";
const char* hostname = "Esp32Nano";
//mqtt stuff
#include <ArduinoMqttClient.h>
const char broker[] = "192.168.0.200";
int port = 1883;
const char topic01[] = "beckys plants/plant1/soil moisture/";
const char topic02[] = "beckys plants/plant2/soil moisture/";
const char topic03[] = "beckys plants/plant3/soil moisture/";
const char topic04[] = "beckys plants/plant4/soil moisture/";
WiFiClient wifiClient;
MqttClient mqttClient(wifiClient);
//variables
int soil1Moisture = 0;
int soil2Moisture = 0;
int soil3Moisture = 0;
int soil4Moisture = 0;
void setup() {
// put your setup code here, to run once:
//start serial, and wait 5 seconds for it to begin
Serial.begin(115200);
delay(5000);
//configure the wifi and begin connection
WiFi.mode(WIFI_STA);
WiFi.setHostname(hostname);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi");
//send period every second we wait for connection to wifi
while (WiFi.status() != WL_CONNECTED) {
Serial.print('.');
delay(1000);
}
//print the local ip address once connected
Serial.println("");
Serial.print("Our Ip address is: ");
Serial.println(WiFi.localIP());
//configure how these pins will work
pinMode(D2,OUTPUT);
pinMode(D3,OUTPUT);
pinMode(D4,OUTPUT);
pinMode(D5,OUTPUT);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(A3,INPUT);
Serial.print("Attempting to connect to MQTT broker: ");
Serial.println(broker);
while (!mqttClient.connect(broker, port)) {
Serial.print("Connection failed! Error code = ");
Serial.println(mqttClient.connectError());
}
Serial.println("You're connected to the broker");
}
void loop() {
// put your main code here, to run repeatedly:
//soil monitoring stuff
soil1Moisture = analogRead(A0);
Serial.println("Plant 1 Moisture : " + soil1Moisture);
soil2Moisture = analogRead(A1);
Serial.println("Plant 2 Moisture : " + soil2Moisture);
soil3Moisture = analogRead(A2);
Serial.println("Plant 2 Moisture : " + soil3Moisture);
soil4Moisture = analogRead(A3);
Serial.println("Plant 2 Moisture : " + soil4Moisture);
delay(5000);
//send plant 1 data
mqttClient.beginMessage(topic01);
mqttClient.print(soil1Moisture);
mqttClient.endMessage();
//send plant 2 data
mqttClient.beginMessage(topic02);
mqttClient.print(soil2Moisture);
mqttClient.endMessage();
//send plant 3 data
mqttClient.beginMessage(topic03);
mqttClient.print(soil3Moisture);
mqttClient.endMessage();
//send plant 4 data
mqttClient.beginMessage(topic04);
mqttClient.print(soil4Moisture);
mqttClient.endMessage();
Serial.println("Messages Sent");
}
and this is the serial output, or at least part of it:
able
Messages Sent
_conf argument is invalid
d
ntr_enable
nyUSB CDC
Messages Sent
onf argument is invalid
d
Messages Sent
): ledc_conf argument is invalid
io_intr_enable
io_num error
Messages Sent
s: %s(%d): ledc_conf argument is invalid
io_intr_enable
By
Messages Sent
: ledc_conf argument is invalid
gpio_intr_enable
if.github.io/arduino-esp32/webusb.html
Messages Sent
ledc_conf argument is invalid