Announcement

Collapse
No announcement yet.

rtc and thingspeak library, stop 4dbutton

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

  • rtc and thingspeak library, stop 4dbutton

    Good morning, I wrote a sketch runs on mega arduino with serial1 @ 200000 connected a 70dct-clb and pin4 to display resetpin.
    The sketch and the display work correctly.
    The problem occurred when I inserted the thingspeak client and the RTC module because the programmed buttons no longer respond.
    I didn't change the code for the display and no change the workshop project (visi genie). I only added the default libraries of thingspeak and ds3231 (https://github.com/NorthernWidget/DS3231) and the relevant code.
    If I edit (/ * * /) the parts related to thingspeak and rtc, the buttons will return to work.
    How can I resolve?
    Thank you



  • #2
    Hello,

    May I ask what pin did you use for your RTC?

    Note that PA12 and PA13 are special pins as it is used primarily for communication with the touch controller.
    If you did use this pins it is more likely that it is the cause why the display didn't work.

    You can refer to this data sheet for for refence: https://www.4dsystems.com.au/product...heet_R_1_6.pdf under Chapter 4.

    Hope it helps.

    Best regards,
    Bern

    Comment


    • #3
      Good morning Bern and thank you for your reply.
      RTC module is connected to arduino mega at pins 20 and 21 (sda and scl).
      Display is connected at arduino with the GEN4-IB converter, I haven't physical connection pins for the display but only serial and reset.

      I read the pdf you refer me, but I understand that refers to the hardware pins that can be used by a converter that uses all 30 pins of the display flat. I understand?

      I paste the code part related to the sw buttons, maybe I wrote some mistakes?

      Code:
      #include <genieArduino.h>
      Genie genie;
      #define RESETLINE 4
      
        Serial1.begin(200000);  //Serial1 @ 200000 (200K) Baud
        genie.Begin(Serial1);  // Use Serial 1 for talking to the Genie Library, and to the 4D Systems display
        genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events
       
        // Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
        // THIS IS IMPORTANT AND CAN PREVENT OUT OF SYNC ISSUES, SLOW SPEED RESPONSE ETC
        // If NOT using a 4D Arduino Adaptor, digitalWrites must be reversed as Display Reset is Active Low, and
        // the 4D Arduino Adaptors invert this signal so must be Active High.  
        pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
        digitalWrite(RESETLINE, 0);  // Reset the Display via D4 
        delay(100);
        digitalWrite(RESETLINE, 1);  // unReset the Display via D4
        delay(3500); //let the display start up after the reset (This is important) 3500
      
        // Set the brightness/Contrast of the Display - (Not needed but illustrates how)
        // Most Displays, 1 = Display ON, 0 = Display OFF. See below for exceptions and for DIABLO16 displays.
        // For uLCD-43, uLCD-220RD, uLCD-70DT, and uLCD-35DT, use 0-15 for Brightness Control, where 0 = Display OFF, though to 15 = Max Brightness ON.
       
      genie.WriteContrast(7);
      
       bool button;
      
      ...some library, int, float...
      
      
      void loop()
      {
      genie.DoEvents();
      
      ...some code...
      }
      
      void(* resetFunc) (void) = 0;//declare reset function at address 0 for arduino
      
      void myGenieEventHandler(void)
      {
        {
        genieFrame Event;
        genie.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below
        genie.GetEventData(&Event);
       if (Event.reportObject.cmd == GENIE_REPORT_EVENT)  // message coming from objects configured to report a message
        {
          if (Event.reportObject.object == GENIE_OBJ_4DBUTTON)  // If the Reported Message was from a 4DButton
          {
            if (Event.reportObject.index == 0)  // If from 4DButton0
            {
             button = genie.GetEventData(&Event); // Receive the event data from 4DButton0
            
             if (button == 0) {          // if 4DButton0 has been released
             }
             else if (button == 1) {     // if 4DButton0 has been pressed
             }
            }
           }
         
          if (Event.reportObject.object == GENIE_OBJ_WINBUTTON) // If a Winbutton was pressed
            {
            if (Event.reportObject.index == 0) {// If Winbutton #0 was pressed   
            genie.WriteContrast(7);
            genie.WriteObject(GENIE_OBJ_FORM, 0, 0);
            }
            }
          if (Event.reportObject.object == GENIE_OBJ_USERBUTTON)
          {
            if (Event.reportObject.index == 9)
            {
              genie.WriteContrast(0);
              genie.WriteObject(GENIE_OBJ_FORM, 5, 0);
            }
            if (Event.reportObject.index == 10)
            {
            pinMode(RESETLINE, OUTPUT); 
            digitalWrite(RESETLINE, 0); 
            delay(100);
            digitalWrite(RESETLINE, 1); 
            delay(3500);
           }
           if (Event.reportObject.index == 11)
           {
           resetFunc(); //call reset
           }
          }
        }
       }     
      }

      Comment


      • #4
        Hello,
        You mentioned that "If I edit (/ * * /) the parts related to thingspeak and rtc, the buttons will return to work."
        It might be that error is coming from there. There not much that we can do since we dont have your full file project.
        If its possible, can you send us the zip file project for us to check.
        If so, use the zip project utility located below the file tab.

        Best regards,
        Bern

        Comment

        Working...
        X