Developer Portal Community

    Showing results for 
    Search instead for 
    Did you mean: 

    E-Bike Datalogger - some hints required

    New Poster

    E-Bike Datalogger - some hints required


    I want to log some datapoints to file while riding. Accessing these values should not make any troubles to me. But writing these to file.. I really don't know how to get started with "local storage".

    I'm not an Java or HTML developer, I only have some basic knowlage. So I'm dependent on help.

    I want to take the grid Example and would like to write every 5 seconds Speed and User Power to a new line, separated with tabulator.

    for now the filename could be hardcodet, but do I have to specify a path? or how does the SDK know where to write the file?

    Thanks in advance


    4 REPLIES 4
    Community Moderator

    Re: E-Bike Datalogger - some hints required

    Hello dkeipp,

    Thank you for posting your question.

    If we understand it correctly, your goal is to persist some data (the speed and the user power). Unfortunately, it is not possible to write directly to a file using HTML5 technologies. Your options would be the following:

    1. Saving the data to local storage and then displaying it when off-ride
    2. Sending the data to a database through an API

    The easiest solution to get started probably is #1. As you probably now, localStorage is a piece of memory in your browser, in which the stored data is saved across browser sessions.

    You would probably implement something as follows:

    function SaveDataToLocalStorage(currentSpeed, currentUserPower)
        var speedValues = [];
        var userPowerValues = []:
        // Parse the serialized data back into an aray of objects
        speedValues = JSON.parse(localStorage.getItem('speedData')) || [];
        userPowerValues = JSON.parse(localStorage.getItem('userPowerData')) || [];
        // Push the new data (whether it be an object or anything else) onto the array
        // Re-serialize the array back into a string and store it in localStorage
        localStorage.setItem('speedData', JSON.stringify(speedValues));
        localStorage.setItem('userPowerData', JSON.stringify(userPowerValues));
    New Poster

    Re: E-Bike Datalogger - some hints required

    Thanks for this snippet! I think it will help me.

    I'm not sure the script is running in the background (Not tested anything yet). So if I switch for example to navigation my module will not be executed anymore.. is that correct? if so, can I do anything that my module (the datalogger) will be executed in the background?


    Community Moderator

    Re: E-Bike Datalogger - some hints required


    In the current version of the SDK, the experiences are fully modular. This means that once you leave the module there is no more data being transmitted to your script in the background.

    New Poster

    Re: E-Bike Datalogger - some hints required

    Dear dkeipp,

    I have exactly the same problem as you. I want to save and store some data points to file or database but I don't know how.
    Have you solved your problem?  Can you help me please by showing me how you solved the problem? 
    I'm really stuck and I need your help. I would be very pleased if you could answer me on this forum or directly to my email address:


    Thanks in advance, and hope you'll answer me because I'm really stuck...

    Can ESER.