You are here

Basic

BASIC

Basic

The program of the eWON is based on a syntax close to the BASIC with many specific extensions. You can integrate your own BASIC code in the eWON to get the desired behaviour or result.
With BASIC, you can change all eWON's parameters but also execute actions such as send emails, send/receive sms, communicate with the Serial protocol or the Ethernet one...
BASIC scripting is available on all eWONs except the eWONs Cosy.

BASIC IDE

Basic IDE

The Basic IDE is a really cool Basic 2 interface which is available on eWON Flexy since firmware version 8.2s0.
This interface allows to manage in an easy way sections inside the code, import or export your code, enjoy the syntax highlighter , perform a search inside your code, debug your code by displaying directly the Errors / Commands / Print in the console...

BASIC 2

Basic 2

This Basic IDE is perfect to render the new functionality that comes with the BASIC 2, an improvement of the Basic first version. This means that the code itself was enhanced with features such as long variable name, wilder range of functions (with parameters, recursive function, …), intelligent labels, ...
Same as the Basic IDE, Basic 2 is available for eWONs Flexy only.

Code Examples

  • Perform a PING function with Basic

    The eWON must often drop something on a server, but first thing to do is to know if this server is available. To check such availability, we use the PING function to test the IP address of the targeted server.eWON has no Ping function, but you can do a similar function with the Basic O...

    GO
  • Change Tag parameter settings for multiple Tags in Basic

    This script example allows to change the tag parameter settings of multiple tags. This could be useful for example to change by scripting the SMS destination parameter for the alarm notification of all the eWON Tags.

    GO
  • Switch to enable WAN connection

    For a machine builder or integrator, contacting remotely a machine via the Internet connection of the Customer LAN is very confortable.For a Customer, having an "exotic" IP device on its network, it is nice to be able, when this device is authorized, to use the Corporate LAN to go on Internet...

    GO
  • How to parse a file

    The script example shown below permit parse a file, in this exemple we use estat.htm to analise and we extract the information below.Gsm IMEIThe International Mobile Equipment Identity is a number, usually unique, to identify GSM . The IMEI number is used by a GSM network to ident...

    GO
  • Extract modem and SIM card info using scripting

    This script example allows to see GsmIMEI, GsmINSI, GsmCellId, GsmLAC, GsmWlessNet & GsmNetRegTxt which located inside "estat.htm".

    GO
  • Extract Date & Time from the eWON

    See how to extract the date and time using eWON's BASIC....

    GO
  • Exchange tag values between eWONs using Instant Value

    Sometimes it is necessary to exchange data between 2 eWONs.For example to send data from a PLC to another PLC located on an other site.To exchange data between 2 eWONs the instant values feature can be used. Instant value means values of Tags at a given time. The Tag's instant values a...

    GO
  • Trigger manually an outgoing connection on modem

    Sometimes it is useful to trigger an outgoing connection by scripting. This could then allow for example to establish a connection to the Internet or or to Talk2M when an acquired Tag is changed.ExplanationThe outgoing connection must be already configured in the eWON.To tr...

    GO
  • Customise the Alarm eMail (or SMS)

    Learn how to modify the alarm message and create your own custom notification.

    GO
  • SMS reception with eWON

    eWON equipped with a GSM/GPRS modem is able to receive SMS.To treat the received SMS, the «ONSMS» function has to be used in conjunction with the «getsys prg,"SmsRead"» function. The following information fields can then be extracted fromevery received SMS :smsF...

    GO
  • Create a tags report and send it by mail

    The purpose of this document is to give an example of how to create a report and send it by mail. The report will contain current tags values and will be generated in text and html formats.

    GO
  • Create a Global Alarm

    Discover how you can set a global alarm to see directly if any of the alarms are active.

    GO
  • Use the OnStatus function to check the result of a scheduled action

    It is possible to check the result of a scheduled action using Basic script in the eWON.

    GO
  • Planner entry with dynamic filename

    We will explain how to create a new entry with Basic for a file that has a dynamic render of its name.

    GO
  • Store and Forward tags

    What we call store&forward is the ability of the eWON to read a value from one protocol and to write this value on another protocol. It's like a "protocol converter" but with limitations.

    GO
  • Launch Talk2M wizard using basic scripting

    Instead of using the web wizard and so configure the Talk2M connection, you can launch it by using some Basic script.

    GO
  • Activate Transparent gateway by scripting

    The Transparent Gateway which means that all IP packets, on all ports except 81 are routed transparently to the selected IP address can be enabled by script.

    GO
  • Find the "null" character

    Bypass the fact that INSTR isn't able to find a specific null character

    GO
  • Develop your own client protocol based on TCP or UDP

    eWON can publish its Tag through Modbus TCP or SNMP protocols natively.However, the BASIC Scripting can be used to develop your own client protocol based on TCP or UDP protocol

    GO
  • Enabling/disabling the WAN interface

    A common example of controlling the WAN communication through scripting is enabling and disabling the WAN port based on the state of a tag.In the example below, the boolean tag Switch enables the WAN port when it is high and disables it otherwise....

    GO
  • Fallback when WAN connection is lost

    In the example below, the VPN connection is tested every 15 minutes while the eWON is using the factory LAN.If the VPN connection is lost, the eWON switches over to the modem connection. After two hours, it checks to see if the Ethernet WAN (using the factory LAN connection) is available a...

    GO
  • Make the eWON compatible with ThingWorx

    ThingWorx is an IoT platform that gathers all kind of data.We managed to succeed in transfering data between the eWON and the IoT Platform.Here's what we code (of course, fields between <> must be replaced by the user ...

    GO
  • XML Parser

    Develop an XML parser in BASIC

    GO
  • MQTT - Get Started

    If you wish to get started with MQTT and the eWON using BASIC scripting, this is where you need to look at....

    GO
  • Enable or disable an IO server

    The following script explains how to start or stop an IO server inside the Flexy thanks to BASIC script.Let's assume that the IO server is initially enabled and has been configured like this (this content can be retrieved from the config.txt file):

    GO
  • Execute actions at specific times

    The following BASIC code show an short example on how the eWON can execute actions / tasks on a defined time frame.For this example, each hour + 0 minute and each hour + 30 minutes, a mail will be sent with the value of a temperature tag.This email must be sent only during working days...

    GO
  • Create a historical logging

    This BASIC script example explains how to log historical data.This suppose that you know how to create a tag on the eWON web interface and that one has already been created with the historical log enabled.This can be useful when the eWON "Logging Deadband...

    GO
  • Manage the eWON communication

    Sometimes, LAN devices (as for example a PLC) connected to your eWON should be able to control the Internet connection of the eWON.

    GO