Read & Write to SDCard in order ?

Inquiry and support for Freematics products
Post Reply
cucugwh
Posts: 6
Joined: Wed May 07, 2014 9:05 pm

Read & Write to SDCard in order ?

Post by cucugwh »

Hello.
I use Freematics OBD-II Adapter (GPS Capable) with BLE. (Firmware v2 : data logger)
I am searching to solution about to read from SDCard to smart device, then write OBD data to SDCard, in order .
Does anyone have good idea or solution?
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Read & Write to SDCard in order ?

Post by stanley »

What do you mean by "read from SDCard to smart device"?
cucugwh
Posts: 6
Joined: Wed May 07, 2014 9:05 pm

Re: Read & Write to SDCard in order ?

Post by cucugwh »

Sorry. My Mistake. My English is not well.
I wanted to do that read to log data in sdcard and send to smart device.
anyway, I fined the solution that I want to do.
thank you. :)
BoxOfSnoo
Posts: 12
Joined: Tue Jun 24, 2014 6:35 am

Re: Read & Write to SDCard in order ?

Post by BoxOfSnoo »

cucugwh wrote:Sorry. My Mistake. My English is not well.
I wanted to do that read to log data in sdcard and send to smart device.
anyway, I fined the solution that I want to do.
thank you. :)


Can you share your solution?
cucugwh
Posts: 6
Joined: Wed May 07, 2014 9:05 pm

Re: Read & Write to SDCard in order ?

Post by cucugwh »

This code is sample.

if recvByte is 0x01, then do "CustomAction1"
CustomAction1 open file, send "SD File context" to target device(iOS, Android) use BLE

Sorry, My Answer is too late.

Code: Select all


void loop()
{
    byte recvByte;
    while(1){
    if(SerialBLE.available())
    {
      recvByte = SerialBLE.read();
    }
   
    if(recvByte == 0x01){

      //Custom Action1
      delay(100);
     
       sdfile = SD.open("Path of Your File ex:csv", FILE_READ);
        if (!sdfile) {
            return;
        }
        else
        {
          SerialBLE.print("datafile exist.");
              while (sdfile.available()) {
                SerialBLE.write(sdfile.read());
              }
         
          sdfile.close();     
        }
        recvByte = 0x03;
    }
   
    if(recvByte == 0x02){
      delay(100);
     
      //Custom Action 2

    }
  }
}

Marek
Posts: 11
Joined: Mon Dec 08, 2014 6:56 am

Re: Read & Write to SDCard in order ?

Post by Marek »

Does it mean the Freematics OBD-2 adapter is capable of dumping info onto sdcard and then read the file and send it via BT to a connected BT device?
Dhruvee
Posts: 1
Joined: Thu Aug 06, 2015 9:26 pm

Re: Read & Write to SDCard in order ?

Post by Dhruvee »

Your thread not clear me so much. If you know more about sd card must visit my website.
Post Reply