error: 'byte' does not name a type

I'm trying to run the "SD basic code" scetch for a SD module with my ArduinoBT ( http://www.sensor-networks.org/index.php?page=0827727742 ) I found in playground and it comes up with the following errors.

C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:50: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:51: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:52: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:127: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:142: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:159: error: 'byte' does not name a type


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:171: error: expected ',' or '...' before 'command'


C:\DOCUME~1\Reaver_\LOCALS~1\Temp\build15745.tmp\/mmc.h:171: error: ISO C++ forbids declaration of 'uint8_t' with no type


 In function 'void loop()':

any ideas?

I suspect the mmc.h needs a

#include <WProgram.h>

Under the:

#ifndef
#define

Part.

thanks.

Now theres just one error.

In function 'void loop()':
error: 'readSectors' is not a member of 'mmc'

I've read mmc and ReadSectors IS a member of it.

In function 'void loop()':
error: 'readSectors' is not a member of 'mmc'

I've read mmc and ReadSectors IS a member of it.

readSectors and ReadSectors are two distinct variable names. C/C++ is case sensitive. :)

Sorry I meant readSectors.

.h
  byte readSectors(byte *buffer, unsigned long sector, byte count);


.cpp

byte mmc::readSectors(byte *buffer, uint32_t sector, byte count) {
  byte sec,res,tmp,errorcount;
  uint16_t crc,recvcrc;

  for (sec=0;sec<count;sec++) {
    errorcount = 0;
    while (errorcount < CONFIG_SD_AUTO_RETRIES) {
      res = sendCommand(READ_SINGLE_BLOCK, (sector+sec) << 9, 0);

      if (res != 0) {
        SPI_SS_HIGH();
        disk_state = DISK_ERROR;
        return RES_ERROR;
      }

      // Wait for data token
      if (!sdResponse(0xFE)) {
        SPI_SS_HIGH();
        disk_state = DISK_ERROR;
        return RES_ERROR;
      }

      uint16_t i;

      // Get data
      crc = 0;
      for (i=0; i<512; i++) {
        tmp = spiTransferByte(0xff);
        *(buffer++) = tmp;
      }

      // Check CRC
      recvcrc = (spiTransferByte(0xFF) << 8) + spiTransferByte(0xFF);

      break;
    }
    deselectCard();

    if (errorcount >= CONFIG_SD_AUTO_RETRIES) return RES_ERROR;
  }

  return RES_OK;
}

I think I'll need to see all the code to be of further assistance.

Maybe you could post your code here: www.arduino.pastebin.com And I'll have a look.

It is the basic example code that comes with the library i’m trying to use.

You can get it here: sensor-networks.org - This website is for sale! - sensor networks Resources and Information.

Or should I post the, .h, .cpp and the .pde code where u suggested?

I can't see any errors in the files you just linked to. Not right away.

Maybe you could zip your exact files, and I'll try them here?

It is the mmc1_v2.pde file under: applet → mmc1_v2 folders.

The compliler highlights the line I highlighted in the link u provided.

#include "mmc.h"
#include "microfat.h"

#define NOT_ENABLED 0
#define READ 1
#define WRITE 2

#define EOL '.'  // used to end the package to write to the board
#define EOF 0  // used to mark end of file

byte buffer[512];
int inByte = -1;
int mode = NOT_ENABLED;

int powerSD = 8;

static unsigned long sector, length;

void setup(void)
{
  Serial.begin(115200);
  pinMode(powerSD, OUTPUT);
  digitalWrite(powerSD, HIGH);
}


void loop(void)
{
  if (Serial.available() > 0) {
    inByte = Serial.read();
    switch (inByte) {
    case 'R':
      mode = READ;
      break;
    case 'W':
      mode = WRITE;
      break;
    default:
      mode = NOT_ENABLED;
      break;
    }
  }

  if (mode == READ)
  {
    mmc::initialize();

    if (microfat::initialize(buffer))
    {

      Serial.println("locate");

      if (microfat::locateFileStart("hola.txt", sector, length))
      {
        Serial.println("read");
        if (RES_OK == mmc::readSectors(buffer, sector, 1))
        {
          if (length > BYTESPERSECTOR)
            length = BYTESPERSECTOR;

          for(int i = 0; i < length; ++i)
          {
            Serial.print(buffer[i], BYTE);
          }

        }
      }
    }
    Serial.println();
    Serial.println("Done Reading");
    mode = NOT_ENABLED;
  }

  if (mode == WRITE)
  {
    mmc::initialize();

    if (microfat::initialize(buffer))
    {

      Serial.println("locate");

      if (microfat::locateFileStart("hola.txt", sector, length))
      {
        Serial.println("read");
        if (RES_OK == mmc::readSectors(buffer, sector, 1))    // [b]The line highlighted from the compiler[/b]
        {
          if (length > BYTESPERSECTOR)
            length = BYTESPERSECTOR;

          int count = 0;
          for(count = 0; count < length; ++count)
          {
            while (!Serial.available()) {
            };
            inByte = Serial.read();
            if (inByte != EOL) {
              buffer[count] = inByte;
            } 
            else break;
          }

          for(int i = count; i < length; ++i)
          {
            buffer[i] = EOF;
          }

          for (int i = 0; i < 10; ++i)
          {
            unsigned long then = millis();
            if (RES_OK == mmc::writeSectors(buffer, sector, 1))
            {
              // we need no information to be sent back at each writting attempt
              //Serial.println("written!");
              //Serial.println(millis() - then, DEC);
            }
          }
        }
      }
    }
    Serial.println();
    Serial.println("Done Writting");
    Serial.println("- read it again to double check");
    mode = READ;
  }

}