Reading form an SD card Teensy 3.6

Status
Not open for further replies.

Dellyjoe

Active member
Hello everyone,

I have a project called: Puzzle Me Chess
Description:
Create a physical chess puzzle on a chess board. This board will have user checkability and software mapped defined chess puzzles. At first there will be 3 different chess puzzles ranging from easy to hard. There will be an OLED screen to show the user where to put the prices to set up the chess puzzle. This project will also have a feature to show user hint or show asnwer. After completing the puzzle a sound will play to tell the user he/she has completed the puzzle.

This is my first Arduino project, I'm using a Teensy 3.6 and I first want to learn how to read from an SD card.

My goal is to have a 8x8 csv file that will have chess piece inside a block.

Example:
8
7
6 WK
5
4 BP
3
2
1
a b c d e f g h

There would be a possible 64 values I would want to pull off from the SD Card but at max I would only be using 32 (one for each piece).

In most cases I would use 10-20 pieces. I would need to take the x and y value of each box in the csv file that has something written in the spot
an example would be b4BP which stands for b4 the x&y and BP then Black pawn. This would then be displayed on an OLED and the user can put that piece in that spot. I would then need to be able to tell if there is nothing in that spot and not count and or use that block.

Does anyone have a place to start? I have a test csv file that kinda looks like the one above, but how do I read from it? is there library's I need?

Thank you for your help in advanced,

Joe
 
The change to SD library to use SdFat ( release ver 2.0 not Beta ) is currently in the Beta release of TeensyDuino 1.54.

Beta 6 of that will be out in some days - when any of that code is available in PIO - unless it runs from installed Beta build is up to PIO update.

To use the TD 1.54 Beta with updated SD install current Beta 5 release linked on Forum into an Arduino IDE build - or wait for the pending Beta 6 version to use in the IDE.

Others using PIO may have other notes for using that code. If the Release 2.0 version of SdFat were associated with PIO build that would be similar to what PJRC release will contain.
 
The change to SD library to use SdFat ( release ver 2.0 not Beta ) is currently in the Beta release of TeensyDuino 1.54.

Beta 6 of that will be out in some days - when any of that code is available in PIO - unless it runs from installed Beta build is up to PIO update.

To use the TD 1.54 Beta with updated SD install current Beta 5 release linked on Forum into an Arduino IDE build - or wait for the pending Beta 6 version to use in the IDE.

Others using PIO may have other notes for using that code. If the Release 2.0 version of SdFat were associated with PIO build that would be similar to what PJRC release will contain.


Thank you for getting back to me Defragster,

Atm I have code that i'm working with on Platform IO and really don't want to move away from that. I just brought Micro SD TF Card Adater Reader Module 6Pin SPI Interface Driver Module with chip Level Conversion for Arduino UNO R3 MEGA 2560 Due and amazon and will wait for that to come in and give that a shot. maybe I can get that working on the teensy. If I can't I will move to a different IDE|

Again thanks for getting back to me It is much appreciated

Joe
 
If you get the built in SD card working instead it will have much better throughput with 4 bit SDIO rather than 1 bit SPI access.

Last beta 5 test done here with SD (on t_4.1 - T_3.6 should be close) using SdFat was reads at 22 MB/s and writes perhaps 15-17 MB/sec IIRC.
 
If you get the built in SD card working instead it will have much better throughput with 4 bit SDIO rather than 1 bit SPI access.

Last beta 5 test done here with SD (on t_4.1 - T_3.6 should be close) using SdFat was reads at 22 MB/s and writes perhaps 15-17 MB/sec IIRC.



hmm well I'm really new at this so I don't think i can get it working I also don t have a lot of coding confidence.

But after work on Friday I should start to learn a little bit more. I will give this a shot first, given how much nicer it will be to get it working better speeds. !!


Thanks again, I hope I get it working,
Joe
 
Thank you for getting back to me Defragster,

Atm I have code that i'm working with on Platform IO and really don't want to move away from that. I just brought Micro SD TF Card Adater Reader Module 6Pin SPI Interface Driver Module with chip Level Conversion for Arduino UNO R3 MEGA 2560 Due and amazon and will wait for that to come in and give that a shot. maybe I can get that working on the teensy. If I can't I will move to a different IDE|

Again thanks for getting back to me It is much appreciated

Joe

Just want to add this hear incase anyone else comes across this issue and needs help.

I was able to get this working with the SD.h and SPI.h library's. I'm currently using the Platform.io and teensy 3.6.

Follow this example if you want to get your internal SD card working.

https://github.com/PaulStoffregen/S...246b20be1282/examples/ReadWrite/ReadWrite.ino

Just had to add const int chipSelect = BUILTIN_SDCARD; end everything seems to be working. Next to figure out how to open and read from a file.

Thank you for reading,
Joe
 
Status
Not open for further replies.
Back
Top