Announcement

Collapse
No announcement yet.

Serial Communication Between Arduino Uno and gen4_iod_24t

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

  • Serial Communication Between Arduino Uno and gen4_iod_24t

    Hi, does anyone have an example of a simple code that can be used to send variables via serial from an Arduino Uno to the gen4-iod_24t? I am struggling to send numerical information to the display from an Arduino Uno. I hope there is an example somewhere that can be shared for educational purposes. Thanks!

    I've tried to adapt the example from the link below but was not sucessful.

    https://www.instructables.com/Arduin...Communication/
    Last edited by eBIMMER; 8 December 2020, 02:01 PM.

  • #2
    Hi,

    Sorry for the delay in answering.

    The IoD-24t has just one Serial port and when using the programming adapter to connect Rx & Tx to another Arduino, comms can be affected by the USB-Serial chip on the programmer.

    The way around this to allow Tx & Rx to be connected to another Serial device is to use a 10 way FPC breakout board similar to this,

    https://www.amazon.co.uk/sourcing-ma...448213&sr=8-16

    When using this adapter your adpted example should work correctly,

    Best regards

    Paul

    Comment


    • #3
      Hi pauleilio, I've been trying to figure this code out for a week without any luck. Do you know of an example floating around where an Arduino sends information to the IoD display for display on the screen?

      The closest I've been able to get is what seems like a couple of zeroes showing up on the screen, though the information sent from the first Arduino was an integer.

      A simple example would be very helpful if you know of one.

      Thank you.

      Comment


      • #4
        Here is a simple example that I got to work. I used an Arduino Uno with the TX and RX pins. Note that this only works properly when the Arduino and IoT display are powered using a power source other than USB. The inherent serial communication thru the USB interface messes with the signal. My application is for auto, so I won't be plugging into a USB except for programming. I hope this helps somebody else!

        Code for the transmitting Arduino:
        Code:
        char mystr[5] = "Hello"; //String data
        
        void setup() {
        // Begin the Serial at 9600 Baud
        Serial.begin(9600);
        }
        
        void loop() {
        Serial.write(mystr,5); //Write the serial data
        delay(1000);
        }
        Code for the gen4-iod-24t:
        Code:
        #include "ESP8266WiFi.h"
        #include "GFX4d.h"
        
        GFX4d gfx = GFX4d();
        
        #define IFONT_OFFSET 0
        
        static const bool inputs[] PROGMEM = {} ;
        
        char mystr[10]; //Initialized variable to store recieved data
        
        void setup()
        {
        Serial.begin(9600);
        gfx.begin();
        gfx.Cls();
        gfx.ScrollEnable(false);
        gfx.BacklightOn(true);
        gfx.Orientation(PORTRAIT);
        gfx.SmoothScrollSpeed(5);
        gfx.TextColor(WHITE, BLACK); gfx.Font(2); gfx.TextSize(1);
        gfx.Open4dGFX("SERIAL~1"); // Opens DAT and GCI files for read using filename without extension. Note! Workshop generates files with Short filenames
        } // end Setup **do not alter, remove or duplicate this line**
        
        void loop()
        {
        // put your main code here, to run repeatedly:
        
        Serial.readBytes(mystr,5); //Read the serial data and store in var
        gfx.println(mystr); //Print data on Serial Monitor
        
        delay(1000);
        
        yield(); // Required for ESP
        }

        Comment


        • #5
          Hi,

          Thank you for the update, I'm glad to hear that it all worked out for you and will be a help to others.

          Best regards

          Paul

          Comment

          Working...
          X