Go Down

Topic: Adafruit 2.8" TFT LCD with MicroSDHC Version 1 Error (Read 164 times) previous topic - next topic

casao01

Hi.
I'm working on developing a prototype of ECG and somehow I have multiple errors with my code but does know how to fix it. Note that this is just a part of my code and I just posted the part where it caused problems and the error code lines don't match the program code so be aware.
Code: [Select]

#include "buttons.h"             // "buttonSet" class provides UI structures and methods
#include "constants.h"           // all constants are defined here
#include "ECGraphics.h"          // local library to interface with LCD
#include <Adafruit_GFX.h>        // Core graphics library
#include <Adafruit_TFTLCD.h>     // Hardware-specific LCD library
#include <TouchScreen.h>         // provides methods for touchscreen interface
#include <TimerOne.h>            // provides easy methods to interface with arduino's hardware timer
#include <SD.h>                  // SD card interface library

ulong lastCmdTime;                                 // used to track time of last command issued
ulong lastMonIndex, lastSpikeIndex, lastBPMIndex;  // used to track other periodic occurrences
ulong curStartIndex, recStopIndex;                 // indexes used for file recording and recalling
volatile ulong TimerIndex;                         // general timer index
volatile ulong MonIndex;                           // monitor mode index counter
volatile uint Sample[Max_Samples];                 // data array for storing sampled input
uint Period[Periods_to_Avg];                       // used to calculate average BPM
uint Baseline = Std_Baseline;                      // used to track changing baseline voltage
uint Peakheight = Std_Peakheight;                  // used to track maximum peak over the baseline (R-wave height)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 360); // set up touchscreen (x & y bounds, resistance)

buttonSet ECGButtons;            // array and methods to comminicate with touchscreen elements (buttons)
Point p;                         // temporary storage for touchscreen coordinates
byte cmd;                        // command code corresponding to a "button" press
byte CurrentState = LOW;         // used to track position on waveform (R-wave = HIGH, between peaks = LOW)
boolean Monitor = false;         // flag used to turn on monitor mode (input sampling & waveform display)
boolean Analyze = false;         // flag used to enable waveforms analysis; not implemented at this time
boolean Record = false;          // flag used to signal recording mode
struct {                         // structure for settings that are saved to file
  byte HRlow, HRhigh;              // high & low heart rate critical values
  uint fileIndex;                  // index for current recorded file
  boolean Alarms;                  // flag to turn on/off audible alarms
  boolean Filter;                  // flag to turn on/off digital filter
} Settings = {50,120,1,true,true};
File configFile, dataFile;         // File handles for settings, recording / recall
File displayFile, parentDir;       // Handles for file manager
char curFileName[12];              // string used to build recorder file name

/******************************************************************
*  Function: File_ShowNext                                        *
*  Purpose: Handles the "Next" button press in the File menu      *
*  Inputs: none                                                   *
*  Description:                                                   *
*     Gets the next entry from the current directory structure,   *
*     displays the file name and file size. Checks if the entry   *
*     is valid, displays or disables the file action buttons.     *
*     TO DO: Check if it's a valid file, display more stats.      *
******************************************************************/

void File_ShowNext()
{
  displayFile = parentDir.openNextFile();          // retrieves next entry in file list
  if (displayFile) {                               // if it's not empty (i.e. end of list)
    strcpy(curFileName,displayFile.name());          // get the file name
    drawTxt(100,70,BLACK,curFileName);               // display the file name
    if (!displayFile.isDirectory()) {                // if it's not a directory (i.e. it's a file)
      ECGButtons.enable(Filemgr_Display);              // enable the file action buttons
      ECGButtons.enable(Filemgr_Delete);
      drawNum(100,130,BLACK,displayFile.size()/2);     // assume it's a valid file and show number of samples it represents
    } else {
      ECGButtons.disable(Filemgr_Display);           // disable the action buttons
    }
    displayFile.close();                             // close the file handle
  } else {
    drawTxt(100,70,BLACK,"            ");            // blank out the file name
    ECGButtons.disable(Filemgr_Display);             // disable the action buttons
    ECGButtons.disable(Filemgr_Delete);
  }
}



The Error message that I got:

Code: [Select]

Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

PECGM5:41: error: 'file' does not name a type
PECGM5:42: error: 'file' does not name a type
PECGM5.ino: In function 'void File_ShowNext()':
PECGM5:58: error: 'displayFile' was not declared in this scope
PECGM5:58: error: 'parentDir' was not declared in this scope
PECGM5.ino: In function 'void Loop_Buttons(byte)':
PECGM5:165: error: 'parentDir' was not declared in this scope
PECGM5:170: error: 'dataFile' was not declared in this scope
PECGM5:170: error: 'SD' was not declared in this scope
PECGM5.ino: In function 'void Menu_Filemgr()':
PECGM5:342: error: 'parentDir' was not declared in this scope
PECGM5:342: error: 'SD' was not declared in this scope
PECGM5.ino: In function 'boolean Record_PrepFile(uint)':
PECGM5:419: error: 'dataFile' was not declared in this scope
PECGM5:419: error: 'SD' was not declared in this scope
PECGM5:419: error: 'FILE_WRITE' was not declared in this scope
PECGM5.ino: In function 'void Record_Writedata()':
PECGM5:444: error: 'dataFile' was not declared in this scope
PECGM5.ino: In function 'void Settings_Update()':
PECGM5:458: error: 'configFile' was not declared in this scope
PECGM5:458: error: 'SD' was not declared in this scope
PECGM5:458: error: 'FILE_WRITE' was not declared in this scope
PECGM5.ino: In function 'void setup()':
PECGM5:590: error: 'SD' was not declared in this scope
PECGM5:594: error: 'configFile' was not declared in this scope
PECGM5:594: error: 'SD' was not declared in this scope
PECGM5:594: error: 'FILE_READ' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.


Go Up