Hi there,
I am having an issue when trying to run the serial monitor in PlatformIO with my Teensy 4.1. I have written a simple piece of code to list all the folders within an SD card. However, when I try to run the serial monitor all it says is: This repeats over and over. I have tried rebooting the Teensy loader as well as checking that the file .hex is readable.
Here is my code:
Any help would be appreciated, Thanks!
I am having an issue when trying to run the serial monitor in PlatformIO with my Teensy 4.1. I have written a simple piece of code to list all the folders within an SD card. However, when I try to run the serial monitor all it says is: This repeats over and over. I have tried rebooting the Teensy loader as well as checking that the file .hex is readable.
Here is my code:
Code:
#include <SD.h>
#include <SPI.h>
#include <string>
String fileExtension = ".wav";
File myPresets;
#define MOSI_PIN 11
#define SCK_PIN 13
#define CS_PIN = BUILTIN_SDCARD
void setup()
{
Serial.begin(9600);
SPI.setMOSI(MOSI_PIN);
SPI.setSCK(SCK_PIN);
if (!(SD.begin(BUILTIN_SDCARD)))
{
// stop here if no SD card, but print a message
while (1)
{
Serial.println("Unable to access the SD card");
delay(500);
}
}
}
int main()
{
int arr[5] = {5, 2, 9, 4, 1};
int *ptr = &arr[2];
printf("The value in the second index of the array is: %d\n", *ptr);
return 0;
}
void loop()
{
// nothing happens after setup finishes.
}
void printDirectory(File dir, int numTabs)
{
while (true)
{
File entry = dir.openNextFile();
if (!entry)
{
// no more files
break;
}
for (uint8_t i = 0; i < numTabs; i++)
{
Serial.print('\t');
}
Serial.print(entry.name());
if (entry.isDirectory())
{
Serial.println("/");
printDirectory(entry, numTabs + 1);
}
else
{
// files have sizes, directories do not
Serial.print("\t\t");
Serial.println(entry.size(), DEC);
}
entry.close();
}
}
Any help would be appreciated, Thanks!