Development

» SD 13: SD card menu

Turn on the SD card. Delete specified filename in the case it exists. The first loop creates the file, but the following loops will not because the file already exists.

Required Materials

1 x Waspmote
1 x Battery
1 x SD card
1 x MiniUSB wire

Notes

This example can be executed in Waspmote v12 and Waspmote v15

Code

/*  
 *  ------ [SD_13] - SD card menu -------- 
 *  
 *  Explanation: Turn on the SD card. Delete specified filename
 *  in the case it exists. The first loop creates the file, but 
 *  the following loops will not because the file already exists. 
 *  
 *  Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details. 
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 *  
 *  Version:           3.0
 *  Design:            David Gascón 
 *  Implementation:    Yuri Carmona
 */


void setup()
{
  // Open USB port
  USB.ON();
  USB.println(F("SD_13 example"));    

  // explore the SD contents
  SD.menu(20000);

  
  USB.println(F("\n\n*** Setup done ***"));
}


void loop()
{  
  // do nothing
}


Output

H#
SD_13 example

------------------------- MENU -------------------------
1: List files in current working directory
2: Show file
3: Change directory
4: Go to Root directory
9: Format SD
--------------------------------------------------------

==> Enter numeric option:1
UPGRADE.TXT 2000-00-00 00:00:00 43
_4G_20_ 2016-09-07 11:33:06 0
FILE1.TXT 2000-01-01 00:02:24 20000
TEST_OT 2000-00-00 00:00:00 6370
INT_FILE.TXT 2000-01-01 00:05:34 844
DATA/ 2009-10-20 17:57:34
LOG 2009-10-20 18:01:04 15728

------------------------- MENU -------------------------
1: List files in current working directory
2: Show file
3: Change directory
4: Go to Root directory
9: Format SD
--------------------------------------------------------

==> Enter numeric option:2
==> Enter name of file to read:UPGRADE.TXT

-------------------
FILE:TEST_OT
PATH:/
SIZE:59464
VERSION:5



-------------------

------------------------- MENU -------------------------
1: List files in current working directory
2: Show file
3: Change directory
4: Go to Root directory
9: Format SD
--------------------------------------------------------

==> Enter numeric option:


*** Setup done ***

Quick Publish: