Announcement

Collapse
No announcement yet.

Getting startedwith 4duino

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • michael_4D
    replied
    Hello,

    the { token stuff.
    That error usually shows up when the braces are not properly closed (e.g. there is an missing/excess openning /closing brace).

    After commenting out the second setup() function, I realized that the first Setup function was missing a closing brace.

    After adding a closing brace, everything compiled properly.

    I get messages of invalid libraries,
    I did not experience this, are you sure you've installed the libraries properly as stated on the 4Duino Datasheet?

    Perhaps it would help if you could post a screenshot of the exact error messages that you're getting.

    Best regards,

    Leave a comment:


  • LimoEZ100
    replied
    I eliminated the second void setup and still did not compile.
    Prior to the verifying portion of the compile program I get messages of invalid libraries,
    Could that have an effect? How do I deal with that?
    I also get initializer messaes and the { token stuff.
    Thanks for input.

    Leave a comment:


  • michael_4D
    replied
    Hello,

    There appear to be two definitions of the setup() function.

    This is what's causing the error on my end.

    I hope this helps.

    Best regards,



    Leave a comment:


  • LimoEZ100
    replied
    Here is my code with the tach routine that compiles when a Uno is connected but does not with 4duino connected.

    // Define LOG_MESSAGES to a serial port to send SPE errors messages to. Do not use the same Serial port as SPE
    //#define LOG_MESSAGES Serial

    %%Display%%.DefineResetLine ; // *Replaced* at compile time with define for reset line connected to the display
    %%Display%%.DefineDisplaySerialx ; // *Replaced* at compile time with define the Serial Port connected to the display

    #include "NoName4Const.h"

    %%Display%%.IncludeSerial_4DLib ; // *Replaced* at compile time with an Include the Serial Library relevant to the display
    %%Display%%.IncludeSerial_Const4D ; // *Replaced* at compile time with an Include the Constants file relevant to the display

    %%Display%%.AssignDisplaySerialtoLibrary ; // *Replaced* at compile time with an Assign of the correct Serial port to the correct library

    // Uncomment to use ESP8266
    //#define ESPRESET 17
    //#include <SoftwareSerial.h>
    //#define ESPserial SerialS
    //SoftwareSerial SerialS(8, 9) ;
    // Uncomment next 2 lines to use ESP8266 with ESP8266 library from https://github.com/itead/ITEADLIB_Arduino_WeeESP8266
    //#include "ESP8266.h"
    //ESP8266 wifi(SerialS,19200);

    // routine to handle Serial errors
    void mycallback(int ErrCode, unsigned char Errorbyte)
    {
    #ifdef LOG_MESSAGES
    const char *Error4DText[] = {"OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0"} ;
    LOG_MESSAGES.print(F("Serial 4D Library reports error ")) ;
    LOG_MESSAGES.print(Error4DText[ErrCode]) ;
    if (ErrCode == Err4D_NAK)
    {
    LOG_MESSAGES.print(F(" returned data= ")) ;
    LOG_MESSAGES.println(Errorbyte) ;
    }
    else
    LOG_MESSAGES.println(F("")) ;
    while (1) ; // you can return here, or you can loop
    #else
    // Pin 13 has an LED connected on most Arduino boards. Just give it a name
    #define led 13
    while (1)
    {
    digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(200); // wait for a second
    digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
    delay(200); // wait for a second
    }
    #endif
    }
    // end of routine to handle Serial errors

    word hndl ;

    void setup()
    {
    // Ucomment to use the Serial link to the PC for debugging
    // Serial.begin(115200) ; // serial to USB port
    // Note! The next statement will stop the sketch from running until the serial monitor is started
    // If it is not present the monitor will be missing the initial writes
    // while (!Serial) ; // wait for serial to be established

    pinMode(RESETLINE, OUTPUT); // Display reset pin
    %%Display%%.Toggle_Reset_On ; // *Replaced* at compile time with correct rest on logic for the attached display
    delay(100); // wait for it to be recognised
    %%Display%%.Toggle_Reset_Off ; // *Replaced* at compile time with correct rest off logic for the attached display
    // Uncomment when using ESP8266
    // pinMode(ESPRESET, OUTPUT); // ESP reset pin
    // digitalWrite(ESPRESET, 1); // Reset ESP
    // delay(100); // wait for it t
    // digitalWrite(ESPRESET, 0); // Release ESP reset
    delay(3000) ; // give display time to startup

    // now start display as Serial lines should have 'stabilised'
    %%Display%%.DisplaySerial.Begin_Speed ; // *Replaced* at compile time with command to start the serial port at the correct speed
    Display.TimeLimit4D = 5000 ; // 5 second timeout on all commands
    Display.Callback4D = mycallback ;

    // uncomment if using ESP8266
    // ESPserial.begin(115200) ; // assume esp set to 115200 baud, it's default setting
    // what we need to do is attempt to flip it to 19200
    // the maximum baud rate at which software serial actually works
    // if we run a program without resetting the ESP it will already be 19200
    // and hence the next command will not be understood or executed
    // ESPserial.println("AT+UART_CUR=19200,8,1,0,0\r\n") ;
    // ESPserial.end() ;
    // delay(10) ; // Necessary to allow for baud rate changes
    // ESPserial.begin(19200) ; // start again at a resonable baud rate
    Display.gfx_ScreenMode(PORTRAIT) ; // change manually if orientation change
    Display.putstr("Mounting...\n");
    if (!(Display.file_Mount()))
    {
    while(!(Display.file_Mount()))
    {
    Display.putstr("Drive not mounted...");
    delay(200);
    Display.gfx_Cls();
    delay(200);
    }
    }
    //hFontn = Display.file_LoadImageControl("NoName1.dnn", "NoName1.gnn", 1); // Open handle to access uSD fonts, uncomment if required and change nn to font number
    //hstrings = Display.file_Open("NONAME~1.txf", 'r') ; // Open handle to access uSD strings, uncomment if required
    hndl = Display.file_LoadImageControl("NONAME~1.dat", "NONAME~1.gci", 1);
    // put your setup code here, to run once:
    int hallsensor = 2; // Hall sensor at pin 2

    volatile byte counter;

    unsigned int rpm;

    unsigned long passedtime;

    void isr()

    {

    //Each rotation, this interrupt function is run twice, so take that into consideration for

    //calculating RPM

    //Update count

    counter++;

    }
    void setup()

    {Serial.begin(9600);

    //Intiates Serial communications

    attachInterrupt(0, isr, RISING); //Interrupts are called on Rise of Input

    pinMode(hallsensor, INPUT); //Sets hallsensor as input

    counter = 0;

    rpm = 0;

    passedtime = 0; //Initialise the values

    }


    // put your main code here, to run repeatedly:

    void loop()
    {
    delay(1000);//Update RPM every second

    detachInterrupt(0); //Interrupts are disabled

    rpm = 60*1000/(millis() - passedtime)*counter;

    passedtime = millis();

    counter = 0;

    Serial.print("RPM=");

    Serial.println(rpm); //Print out result to monitor

    attachInterrupt(0, isr, RISING); //Restart the interrupt processing

    }

    Leave a comment:


  • michael_4D
    replied
    Hello,

    Have you done the setup procedures that were stated on the 4Duino Datasheet?

    If you need a further reference on building a project for the 4Duino-24, you may consult the projects section of the 4Duino website.

    4Duino Projects:
    https://www.4duino.com/projects/

    4Duino Product Page:
    https://www.4duino.com/product/

    Best regards,

    Leave a comment:


  • LimoEZ100
    replied
    Just created a display in workshop and tried to compile and got invalid library found Visi Genie Arduino library master...

    Leave a comment:


  • LimoEZ100
    replied
    I also have a 4duino display Arduino file that when I go to verify it compiles but this is just the display code created by 4duino

    Leave a comment:


  • LimoEZ100
    started a topic Getting startedwith 4duino

    Getting startedwith 4duino

    I have programed other 4D displays using Visi Genie. I am trying to build a simple display for a tachometer and have the code working in Arduino printing RPM to the serial screen on the PC. I tried to perform all of the functions to set up for the 4duino. I built the screen in workshop and it generated code. I do not know how to get the program in Arduino to integrate into the 4duino world. I thought looking at one of the projects on line specifically the code but cannot find code examples. The options to build a project are confusing. Is there a step by step project that could serve as a guide on line? Thanks for any input.
Working...
X