No announcement yet.

Retrieving a data value from Arduino microcontroller host

  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving a data value from Arduino microcontroller host


    I am trying to learn how I can code up my 4d uLC 43dt touchscreen in 4d Visi environment so that at the beginning of the code a data value can be retrieved from an Arduino microcontroller host. I would use this data value as input for some of my functions in the 4d Visi code.

    Much thanks for your help,

  • #2
    you would need to create a protocol to communicate how you want to receive the data from the arduino. you could have the arduino send it's value every second or so over uart, or read it over i2c, or spi, depending on how you want to communicate with it. you will then need to parse the data if it's over uart, or if your using arduino as i2c or spi slave, you could just request the necessary bytes and pull in the values without needing to parse.


    • #3
      Here is a sample for I2C display HOST and arduino SLAVE


      • #4
        How would you do it over uart with Arduino? I am trying to learn how it may have been done for the Arduino so that I can learn how to do the same functionality using a mbed microcontroller


        • #5
          i use the visigenie environment however the host will be the arduino, or other mcu you use, but you want the lcd to be host? its different setup


          • #6
            Dear Srineil,

            Here are the links which can help you understand the VISI environment.

            ViSi Getting Started First Project for Picaso and Diablo16:

            ViSi Displaying Images from the uSD Card - WYSIWYG FAT16:

            Designer or ViSi Analogue Input:

            ViSi Displaying Third Party Fonts FAT16:

            ViSi Images and User Images:

            Designer or ViSi Custom Gauges:

            ViSi The LED Digits Object:

            ViSi Winbuttons:

            ViSi Input Objects:

            ViSi Data Loop Back Testing of Serial Hardware:

            ViSi Gauges Objects Part I:

            ViSi Gauges Objects Part II:

            Here is a link how to connect a 4D LCD to the Arduino:
            ViSi-Genie Connecting a 4D Display to an Arduino Host:

            You can use this Visi code fragment to get data from the Arduino.
            Using Software Serial using Digital Pins 2 and 3 of the Arduino Uno,
            connect the 4D LCD using a gen4-PA to get access to COM1 of the 4D module.

            var buffer[10];
            var serial_buffer[10];
            var counter;
            var i;
            var data;

            com_SetBaud(COM1, 960); // 9600 baudrate (baudrate/10)
            COM1_RX_pin(PA2); //GPIO2 of the gen4-PA
            COM1_TX_pin(PA3); //GPIO1 of the gen4-PA


            counter:= com1_Count();

            if(counter>5) //size of your packet

            data:=buffer[0]; //Depending on your protocol display data in widget

            // Coolgauge1 1.0 generated 2/14/2017 10:24:41 AM
            img_SetWord(hndl, iCoolgauge1, IMAGE_INDEX, data) ; // where frame is 0 to 100 (for a displayed -1 to -1)
            img_Show(hndl,iCoolgauge1) ;

            best regards,