Main Site Documentation

Visual Basic 2012 - Fez Hydra - Oled Display - Reading FROM an SD Card


#1

Hi

I have been using the SD card on the Fez Hydra and got it to write .csv files with incremental numbers every time an event happens with no (well a few) problems.

My question is if I had a couple of fields displayed on the OLED, say surname, first name, how would I read that data from an SD card in a txt or csv file and fill in the field? Surname: Smith First name: Tom - getting Tom Smith from a file on the card.

I am still really finding my feet using Visual Basic 2012 so a clear explanation with statements would be brilliant please.

I then suppose its how I would go through different records all in one file, but I will start with the first question! Thanks


#2

I can’t tell you anything sensible in VB land sorry (and barely in C# :slight_smile: ) but here’s how I would approach this.

Figure out how to write text to the display. Create a string and put that somewhere on your OLED display. Then change the string and update the display. This teaches you how to get the output portion working.

Figure out how to read strings from a file on SD card. On your SD card, just have a file that has lines of text like “Surname: Smith”. Then output those lines to your (working) OLED code. This teaches you how to get the SD card reading working.

Figure out how to get and use user interaction. Make sure you have enough concepts like “next” and “previous” because you’re going to need that in your scenario. Do you have hardware to do this like push buttons - and how are you going to react to those button presses.

Figure out how to parse text. Figure out how when you read a line that says “Tom Smith” and “Tom Jones-Smith” how to get the component parts. Then write the component parts to the OLED. This relies on the working SD card code, and the working OLED code.

Then think about stranger cases, like “Tom De Angeles” (and as many other things you can think of). Think about how you might use typical CSV delimiters like double-quotes around strings and commas to separate values. At this stage you will probably throw out your original parse code and make something more robust that handles CSV format and decide this is a good idea to use from now on :slight_smile: Again, test it by writing to the OLED.

Then include multiple lines of data into your file and iterate through them, when directed via user interaction that you got working earlier.

Each time you build on a concept you’ve explored and succeeded with. Each one is discrete enough to be less daunting, and you’ll find examples on the net for this (although VB examples in netmf will be scarce, you are among the minority doing this - but there are vb examples on the codeshare here)

good luck - and when you hit a specific question, not just a big open ended generic one like this, come back and ask. You’ll find we’re all interested in helping you fish, but not in tying the fish to your line first up, so you’ll get maximum help (and maximum learning too) when you’ve tried and shown us how you’ve hit a problem, rather than just asking for documented code :wink:


#3

@ Linkin1977 - i use a spider and a T35 but i think that down’ mattert. Please specify your problem (see Brett’s post) so its easer to help. Don’t be scared looking a the c# examples, there a only a few differences to vb code:

c# Type VarName
vb Dim VarName as Type

c#
if … then
{
code
}

vb
if … then
code
end if

and so on, the commands and objekts are the same. So tis easy th find the vb-way


#4

Thanks Daniel, I am totally new to the programming but I am starting to solve things and make headway. Like anything you learn it is daunting at the minute so all the help is extremely appreciated. Being a secondary teacher myself I appreciate the help building confidence.