Skip to content

borborich/SmartDisplay_Arduino_Examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartDisplay Arduino Examples

Development Environment

  • Arduino IDE v2.0.4

Information

These Examples provide the following help:

  • Description example of control gauge

  • New example Demo_With_Gauge_Indicator_Button

  • Added new example Changing_Pages_Through_Physical_Button

  • Added new example Changing pages through Touch and Physical button both. Temperature and humidity sensor reading the temperature data.

  • Added a demo, based on the Modbus interface for Page-switching functions and buzzer function.

  • To be added

  • Release date: October 13th, 2023

  • A new exclusive demo, based on the Modbus interface, has been added as an example which offers the features such as

    1. Page-switching functions via touch buttons.
    2. Multiple buzzer beeping counter with multiple buttons.
  • Release date: August 30th, 2023 A new exclusive demo, based on the CAN open interface, has been added as an example which offers a number of features such as page-switching functions via touch and physical buttons. Temperature and humidity sensor reads room temperature data. The touch button controls the indicator. Brightness is being controlled through brightness control slider.

New example Changing_Pages_Through_Physical_Button is demonstration Arduino mega 2560 through [Arduino RS485 shield] https://wiki.dfrobot.com/Arduino_RS485_Shield_SKU__DFR0259#target_2 [Smart Display Modules Modbus 3.5"]https://www.winstar.com.tw/products/smart-display.html The demo code included with [Modbusmaster] library was made for the Smart Display.

Demo_With_Gauge_Indicator_Button example is demonstration Arduino mega 2560 through Canbus shield control Smart Display Modules CANbus 3.5".

This Examples will work with all Smart Display CANbus Modules.

The demo code included with CanFestival library was made for the Smart Display CANbus,

however is easily be adapted to other size displays.

smart_display_gauge.mp4

Installation

The repository should be placed in the C:\Users(User name)\My Documents\Arduino\Libraries, or equivalent. (restart the IDE if already open)

image

For more information on the installation, please refer to [Installing Additional Arduino Libraries] (http://arduino.cc/en/Guide/Libraries)

General Examples Discussion

These objects (widget) are inserted into through writeNetworkDictCallBack and update data from the ObjectFuncallback function.

// set value change callback function 
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx01_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx02_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx03_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx04_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx05_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx06_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx07_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx08_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx09_id, obj_getValue, (ODCallback_t) ObjectFuncallback);
RegisterSetODentryCallBack(&SmartDisplay_Data, Idx10_id, obj_getValue, (ODCallback_t) ObjectFuncallback);

/**
 * @brief  upddate the value from the local object dictionary
 * @param  OD Pointer to a CAN object data structure
 * @param  unsused_indextable
 * @param  unsused_bSubindex
 * @retval 
 */
UNS32 ObjectFuncallback ( CO_Data* d, const indextable *unsused_indextable, UNS8 unsused_bSubindex )
{
  Serial.println(F("ObjectFuncallback get value"));

  uint32_t expectSize;
  uint8_t dataType;

  readLocalDict( &SmartDisplay_Data, Idx01_id, obj_getValue, &gaugeValue, &expectSize, &dataType, 0 );

  return 0;
}

/**
 * @brief  update value of object (widget) to destination node via CANopen API 
 *         if SDO thread is empty
 * @param  None
 * @retval Return true.
 */
bool ConfigCmdFun(void)
{  
  ConfigCmd cmd;
  uint8_t res;
  uint16_t data;

  if(doConfig)
    return true;
      
  if( configCmdQueue.pop(&cmd) ){
  
    sprintf( prbuf, "ConfigCmdFun nodeId :%4.4x, index %04x,subIndex %03x", CLIENT_ID, cmd.index, cmd.subIndex );
    Serial.println(prbuf);
    
    data = cmd.data;
    res = writeNetworkDictCallBack ( &SmartDisplay_Data, /*CO_Data* d*/
                   /**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
    CLIENT_ID,     /*UNS8 nodeId*/
    cmd.index,     /*UNS16 index*/
    cmd.subIndex,  /*UNS8 subindex*/
    cmd.count,     /*UNS8 count*/
    cmd.dataType,  /*UNS8 dataType*/
    (void*)&data,  /*void *data*/
    CheckSDO,      /*SDOCallback_t Callback*/
    0);            /* use block mode */

    doConfig = 1;
  } 
  
  return true;
}

Available Object Types

This section lists all of the objects/widgets that are available to be used by this Smart Display Module (CANbus),

which represent each of the widgets available to be placed using the Smart Display GUI Builder.

Please refer to the Smart Display GUI Builder simulator feature for more information about to use each widget.

It can display the interactive message on how to send data through CAN bus to Smart Display.

typedef enum
{
  TYPE_EMPTY            = 0,
  TYPE_IMAGE            = 1,
  TYPE_GAUGE            = 2,
  TYPE_BDI              = 3,
  TYPE_BUTTON           = 4,
  TYPE_TOGGLE_BUTTON    = 5,
  TYPE_VerticalSlider   = 6,
  TYPE_HorizontalSlider = 7,
  TYPE_CheckButton      = 8,
  TYPE_Temperature      = 9,
  TYPE_Battery          = 10,
  TYPE_Graph            = 11,
  TYPE_Indicator        = 12,
  TYPE_CircleProgress   = 13,
  TYPE_ImageProgress    = 14,
  TYPE_GroupButton      = 15,
  TYPE_AnimatedImage    = 16,
  TYPE_NumberStr        = 17,
  TYPE_TextStr          = 18,
  TYPE_CustomWidget     = 19,
  TYPE_DigitalClock     = 20,
  TYPE_Max,
} OBJECT_TYPE;

About

SmartDisplay_Arduino_Examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 93.9%
  • C++ 6.0%
  • Processing 0.1%
  • Python 0.0%
  • Ruby 0.0%
  • Makefile 0.0%