SPARKFUN ESP32VROOM PLUS C(PART# WRL-20168) does not recognize the SD card when using the ARDUINO IOT cloud editor. The sparkfun example code SD_test.ino works fine.
Here is the Arduino IOT code I am using, I am getting "Card Mount Failed"and “No SD card attached”;
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/6b7debab-1df0-4ab0-b3a8-96d9381a8a44
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int TargetLaunch;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include "FS.h"
#include <SPI.h>
#include <SD.h>
const int sd_cs = 5; //Thing Plus C
int targetPin = 33; //INCREMENT TARGETS COUNT, SEND TO SD CARD
int target;
int count;
int counter;
int countPin = 12; //RESET COUNTER TO ZERO
void setup() {
pinMode(targetPin,INPUT);
pinMode(countPin,INPUT);
// 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);
Serial.println("SD test");
if (!SD.begin(sd_cs)) {
Serial.println("Card Mount Failed");
//return;
}
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD card attached");
//return;
}
Serial.print("SD Card Type: ");
if (cardType == CARD_MMC) {
Serial.println("MMC");
} else if (cardType == CARD_SD) {
Serial.println("SDSC");
} else if (cardType == CARD_SDHC) {
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
Serial.printf("SD Card Size: %lluMB\n", cardSize);
Serial.println("FILE NAME = Untitled 4/16/2023");
// 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();
}
void loop() {
ArduinoCloud.update();
counter = digitalRead(countPin);
if (counter == HIGH)
{
Serial.println("counter == HIGH");
count = 0;
}
target = digitalRead(targetPin);
if (target == HIGH)
{
Serial.println("target == HIGH");
}
}
/*
Since TargetLaunch is READ_WRITE variable, onTargetLaunchChange() is
executed every time a new value is received from IoT Cloud.
*/
void onTargetLaunchChange() {
// Add your code here to act upon TargetLaunch change
}