Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Write data on SDCard with button_one.pressed and every x seconds simultaneously

    THM
    New Poster

    Write data on SDCard with button_one.pressed and every x seconds simultaneously

    Hello Community,

    I'm trying to write Data in the storage of my SDCard. 
    First test, I configured the SDCard Setup and wrote data in the storage and printed it on the console when button one was pressed. 

    Code #1:

    package main;
    import platforms.xdk110;

    setup storage : SDCard{
    var wo = appendingTextWrite("xdk.txt");
    var ro = resumingTextRead("xdk.txt",4);
    }

    every button_one.pressed {
    print("appendingFile_Text, Taste \n");
    storage.wo.write("MAHA, Taste");
    }

     

    Following test should include writing data in storage and console every x second/s. That didn't work at all. The XDK wrote appendingFile_Text, Sekunde on the console but never even opened a file. When button one was pressed there was no reaction - therefore nothing printed on the console. 

    Code #2: 

    package main;
    import platforms.xdk110;

    setup storage : SDCard{
    var wo = appendingTextWrite("xdk.txt");
    var ro = resumingTextRead("xdk.txt",4);
    }

    every button_one.pressed {
    print("appendingFile_Text, Taste \n");
    storage.wo.write("MAHA, Taste");
    }

    every 1 second {
    print("appendingFile_Text, Taste \n");
    storage.wo.write("MAHA, Taste");
    }

     

    I figured out that there was a problem in enabeling with these two:
    INFO | XDK DEVICE 1: [INFO, C:/Users/---/XDK-Workspace/Test1/src-gen/main.c:122] enable InputOutputSDCardStorage succeeded
    INFO | XDK DEVICE 1: [INFO, C:/Users/---/XDK-Workspace/Test1/src-gen/main.c:132] enable SensorButton_one succeeded

    These lines appeared when Code #1 was flashed on to the device, but not when Code #2 was flashed. 

     

    Why could that be?

    Thanks for your help in advance!

    3 REPLIES 3
    Mahalingam
    Occasional Contributor

    Re: Write data on SDCard with button_one.pressed and every x seconds simultaneously

    Hello THM

    I am able to Write data on SDCard with button_one.pressed and every x seconds simultaneously.

    I modified the code #2 little bit to inorder to see difference.

     

    package main;
    import platforms.xdk110;
    
    setup storage : SDCard{
    var wo = appendingTextWrite("xdk.txt");
    var ro = resumingTextRead("xdk.txt",4);
    }
    
    every button_one.pressed {
    print("appendingFile_Text, Taste1 \n");
    storage.wo.write("MAHA1, Taste1");
    }
    
    every 1 second {
    print("appendingFile_Text, Taste \n");
    storage.wo.write("MAHA, Taste");
    }

     

     

    I compiled the application and Flashed application into XDK device. Data was written on sdcard for every 1 second. Inbetween I pressed button-1 two times, Data was written on sdcard for button-1 press. I check in the file content in sdcard. Data was written successfully. Please find the console log below,

     

    INFO | Connection to port 'COM4' established
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 

     

     

     

    THM
    New Poster

    Re: Write data on SDCard with button_one.pressed and every x seconds simultaneously

    Hello Mahalingam,

    thanks for the replie. 

    I tried that and tried to update the workbench as the support told me to, but it still does not work. I do not know what else I could try. 

    The problem with the "INFO" line still occures. Do you have an idea why that could be?

    Regards!

    Mahalingam
    Occasional Contributor

    Re: Write data on SDCard with button_one.pressed and every x seconds simultaneously

    Hello THM

    The problem is not with the INFO message, because I am also not getting any INFO message when I flash both code 1 and 2.

     

    Please find the Code-1 Console log below,
    
     INFO | Flashing file 'C:/Users/XDK-Workspace/EclipseMitaApplication/src-gen/debug/EclipseMitaApplication.bin'...
     INFO | XDK DEVICE 1: Ready
     INFO | XDK DEVICE 1: C
     INFO | XDK DEVICE 1: 
     INFO | XDK DEVICE 1: XMODEM Download Success
     INFO | XDK DEVICE 1:  CRC of application area
     INFO | XDK DEVICE 1:  CRC0000EE21
     INFO | Application checksum 'ee21' successfully verified.
     INFO | Transmission successfully completed!
     INFO | Booting application...
     INFO | XDK DEVICE 1:  Performing application CRC validation (this will take a couple of seconds)
     INFO | XDK DEVICE 1:  Jumping to application
     INFO | Port 'COM4' has been disconnected
     INFO | Connecting to XDK device 'XDK Device 1' in port 'COM4'...
     INFO | Connection to port 'COM4' established
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 

     

     

     

    Please find the console log for Code-2 below,
    
     INFO | Flashing file 'C:/Users/XDK-Workspace/EclipseMitaApplication/src-gen/debug/EclipseMitaApplication.bin'...
     INFO | XDK DEVICE 1: Ready
     INFO | XDK DEVICE 1: C
     INFO | XDK DEVICE 1: 
     INFO | XDK DEVICE 1: XMODEM Download Success
     INFO | XDK DEVICE 1: c
     INFO | XDK DEVICE 1:  CRC of application area
     INFO | XDK DEVICE 1:  CRC000021A3
     INFO | Application checksum '21a3' successfully verified.
     INFO | Transmission successfully completed!
     INFO | Booting application...
     INFO | XDK DEVICE 1: b
     INFO | XDK DEVICE 1:  Performing application CRC validation (this will take a couple of seconds)
     INFO | XDK DEVICE 1:  Jumping to application
     INFO | Port 'COM4' has been disconnected
     INFO | Connecting to XDK device 'XDK Device 1' in port 'COM4'...
     INFO | Connection to port 'COM4' established
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste1 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | XDK DEVICE 1: appendingFile_Text, Taste 
     INFO | Port 'COM4' has been disconnected

     

     

    For me code 2 is working properly without any issue. I am able to Write data on SDCard with button_one.pressed and every x seconds simultaneously. I also verified the log files in sdcard as well. Data are written successfully in sdcard.

    Are you still not able to Write data on SDCard with button_one.pressed and every x seconds simultaneously? Is it your problem?

    If yes, Could you please share your complete console log and sdcard log?

    If there is no log in sdcard, then the problem could be in your card. If that is the case, then try out with new sdcard.

    You said that code-1 is working. Did you check whether xdk.txt file was created in sdcard and there is some contents in that file when you pressed button-1? Please check. If there is no file, then the problem could be in sdcard. If that's the case, then try replacing the new sdcard.

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist