Announcement

Collapse
No announcement yet.

Retrieving a data value from Arduino microcontroller host

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

  • Retrieving a data value from Arduino microcontroller host

    Hello,

    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,
    Neil

  • #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.

    Comment


    • #3
      Here is a sample for I2C display HOST and arduino SLAVE http://forum.4dsystems.com.au/forum/...slave-problems

      Comment


      • #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
        Thanks

        Comment


        • #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

          Comment


          • #6
            Dear Srineil,

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

            ViSi Getting Started First Project for Picaso and Diablo16:
            --> http://www.4dsystems.com.au/download...119_R_1_01.pdf

            ViSi Displaying Images from the uSD Card - WYSIWYG FAT16:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00069/

            Designer or ViSi Analogue Input:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00052/

            ViSi Displaying Third Party Fonts FAT16:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00080/

            ViSi Images and User Images:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00074/

            Designer or ViSi Custom Gauges:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00079/

            ViSi The LED Digits Object:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00081/

            ViSi Winbuttons:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00068/

            ViSi Input Objects:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00078/

            ViSi Data Loop Back Testing of Serial Hardware:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00072/

            ViSi Gauges Objects Part I:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00082/

            ViSi Gauges Objects Part II:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00083/


            Here is a link how to connect a 4D LCD to the Arduino:
            ViSi-Genie Connecting a 4D Display to an Arduino Host:
            --> http://www.4dsystems.com.au/appnote/4D-AN-00017/

            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

            com1_Init(serial_buffer,10,0);

            counter:= com1_Count();

            if(counter>5) //size of your packet
            for(i:=0;i<10;i++)
            buffer[i]:=serin1();
            next
            endif

            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,

            Comment

            Working...
            X