Difference between revisions of "App Developer Examples"
Line 122: | Line 122: | ||
The example consists of a server and a client, the server sits and listens for incoming connections from clients and then services their requests. | The example consists of a server and a client, the server sits and listens for incoming connections from clients and then services their requests. | ||
− | In the | + | The server pulls in any data sent to it and looks for a command start code ":" followed by a command body and terminated with a command end code ";\n". |
+ | |||
+ | Once it receives this it processes the command. The first byte sent after the command start is the command code and tells the server what the client is trying to do. This then provides the basis on what to do next, bytes to send and receive etc. | ||
+ | |||
+ | In the examples we have two commands A and B which are created in the ProcessCommand macro. | ||
+ | |||
+ | A takes a floating point value from the client and passes to the server. | ||
+ | |||
+ | B takes a floating point value from the server and passes to the client. | ||
{{Fcfile|AD_Server.fcsx|App Developer AllCode API Server}} | {{Fcfile|AD_Server.fcsx|App Developer AllCode API Server}} |
Revision as of 08:55, 19 May 2022
Contents
Template Examples
More example projects can be found by looking at the templates when creating a new App Developer project in Flowcode.
General Examples
Parametric graphs allows user to enter equations for X and Y, and then plot them. Which results in some very nice plots.
Simple drawing example using sliders to set the drawing pixel coordinate.
Example of Flowcode asking questions using UI dialogue boxes.
Temperature forecasts for 3 user-entered locations in graph form.
AllCode Examples
Formula AllCode
A simple example showing how to drive the Formula AllCode robot around in API mode using a panel based joystick control.
The COM port for the Formula AllCode can be set via the panel properties which can be exposed to the SCADA runtime user.
MIAC AllCode
A simple example showing how to drive the MIAC AllCode PLC from a SCADA application using Bluetooth or WIFI.
Arduino Examples
Arduino Uno Custom Slave
A simple example demonstrating how to use an Arduino loaded with custom firmware with Flowcode SCADA.
Firstly we have an embedded project targetting an Arduino Uno that is connected to a bank of LEDs, a bank of switches and a temperature/humidity sensor.
Secondly we have a SCADA project that can interrogate and control the Arduino Uno allowing access to the switches, termperature and humidity while also allowing the LEDs to be controlled.
Internet Based Examples
MQTT
Local Weather
A simple example demonstrating how to use MQTT with Flowcode SCADA to get the local weather conditions.
The example shows temperatures from Halifax in the UK and from Sydney in Australia.
Publish and Subscribe
A simple example to combine together an embedded device and a SCADA application.
Firstly we have an embedded Raspberry Pi project connected to an I2C Sensor, the sensor is sampled and the data is published to a MQTT server.
Next we subscribe to the data and receive it back into Flowcode SCADA.
Modbus TCP
A simple example demonstrating how to use the Modbus TCP components with Flowcode SCADA.
Here we have two Flowcoded SCADA projects communicting with each other. Though the master or slave could be replaced with embedded Modbus TCP hardware.
Webserver Embedded Files
A simple example demonstrating how to host a website with fixed HTTP content including dynamic sections that can be passed in and out of Flowcode SCADA.
For example a dynamic section could be used to display a variable value on a webpage such as a temperature or used to control Flowcode e.g. turn on an output.
Webserver Dynamic Files
A simple example demonstrating how to host a website with dynamic content based on external files including dynamic sections that can be passed in and out of Flowcode SCADA.
For example a dynamic section could be used to display a variable value on a webpage such as a temperature or used to control Flowcode e.g. turn on an output.
App to App Comms
A simple example demonstrating how to transfer data from one App Developer Application to another.
The example consists of a server and a client, the server sits and listens for incoming connections from clients and then services their requests.
The server pulls in any data sent to it and looks for a command start code ":" followed by a command body and terminated with a command end code ";\n".
Once it receives this it processes the command. The first byte sent after the command start is the command code and tells the server what the client is trying to do. This then provides the basis on what to do next, bytes to send and receive etc.
In the examples we have two commands A and B which are created in the ProcessCommand macro.
A takes a floating point value from the client and passes to the server.
B takes a floating point value from the server and passes to the client.
App Developer AllCode API Server
App Developer AllCode API Client
Generic Examples
Industrial Tanks
A simple example showing the hoppers, valves and pipes working together. Each tank automatically empties in turn.
Key Mappings
A simple example showing the use of key mapping to switch three LED outputs on and off using the number keys 1, 2 and 3.
The keys are assigned via the Edit -> Key Mappings menu in Flowcode and continue to work after the SCADA project has been exported as a stand alone project.