Menu

nxcEditor Simulator not working properly with standard NXC functions

Help
2016-08-25
2016-09-18
  • Hans Toquica

    Hans Toquica - 2016-08-25

    Greetings,

    First of all, thanks for the awsome program, I have been able to use it for some projects. However, as I use the LEGO brick for academic purposes, I am often requiring to obtain information from the brick, the way I often do it is by creating a file in my programs. Usually I use both the functions DeleteFile, CreateFile and WriteLnString (among others). This works in the real thing.

    It has come the time I need to use the simulator to do the same job, create a file which will be used to store information and then be able to delete it whenever I've obtained that information. I noted that nxcEditor allows me to retrieve the file from the real brick, it would be awsome to do the same with the simulation.

    Also, the function StrCat does not work properly either (the string I am asking to be printed in the LEGO screen will not show properly).

    A sample of the simple code I am using is the one below.

    long ref = 180;
    long position;
    long u;
    
    byte fileHandle;
    string s;
    short bytesWritten;
    
    string write;
    
    task main(){
    DeleteFile("test.txt");
    CreateFile("test.txt",20000, fileHandle);
    
    while(true){
    
       position=MotorRotationCount(OUT_A);
       TextOut(0, LCD_LINE2, StrCat("position:",NumToStr(position)));
       TextOut(0, LCD_LINE3, StrCat("Setpoint:",NumToStr(ref)));
    
    if(position > ref){
          OnRev(OUT_A,75);
          }
    
    else if(position < ref){
          OnFwd(OUT_A,75);   
          }   
    
        s=NumToStr(position);
        write = StrCat(s," ");
        WriteLnString(fileHandle,write, bytesWritten);
        Wait (7);
        ClearScreen();
        }
        CloseFile(fileHandle);
    }
    

    The operative system I am using is Kubuntu 16.04 with nxcEditor 0.1.6.

    Entirely yours,

    Toquica

     

    Last edit: Hans Toquica 2016-08-25
  • Knefel

    Knefel - 2016-09-14

    Greetings, too!

    First read "nxcSimulator -> Brief information ..." (http://nxceditor.sourceforge.net/).
    I made a few tests and added the following functions to the simulator:
    - DeleteFile
    - CreateFile
    - WriteLnString
    - WriteString
    - CloseFile
    The simulator now has a file manager. If I've added the functions:
    - NumToStr
    - StrCat
    I'll upload a new version. Please use for further wishes: "Open Discussion -> Wish list".

    Best regards
    Frank

     
  • Knefel

    Knefel - 2016-09-18

    The new version is available now: "https://sourceforge.net/projects/nxceditor/files/nxcEditor/" (version 0.4.3). I've tested your sample program successfully.

    There will be an update of the webpage in the near future with some informations about: using Arduino, Raspberry Pi and EV3 with the editor (and some new functions like creating backups and achives).

    Best regards
    Frank

     

Log in to post a comment.