Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Server API

Kristian Skov edited this page Sep 28, 2018 · 19 revisions

Table of Content

Overview

Up to date as of version 1.6

A new feature is a server API, so that you can make a program yourself, that can use the features of ArduLED.

Server Settings

Error Loading Image

The server settings window is really just a console, where you can start and stop the server. As well as making the server start by itself on startup of ArduLED. The IP address can also be changed if desired, however the default should work in most cases.

Test Program

With this new API, a test program have been added (under Source Code) where you can manually send commands to ArduLED, just so you can se how it works, and so that you have a sample of how to connect to it in your own program.

Error Loading Image

The API commands

There is a preset number of commands to choose from, which are listed here:

Command Function
GETTOTALLEDCOUNT() Gets the current total LED count in the currently send setup
GETSERVERNAME() Gets the name of the server
FADECOLOR(bool FromZero, int FromID, int ToID, int R, int G, int B, int FadeSpeed, int FadeFactor) bool FromZero: If the program is to first set the LEDs to RGB code 0 0 0, before sending the desired colors int FromID: From what Software ID to start from int ToID: To what Software ID to go to int R: The color code for Red (0-255) int G: The color code for Green (0-255) int B: The color code for Blue (0-255) int FadeSpeed: The speed in ms it takes for each color jump (see the Fade Colors section for more info) int FadeFactor: The factor of how hard to make each color jump (the value 10 would be equal to a fade factor of 0.1) (see the Fade Colors section for more info)
INDIVIDUALCOLOR(int Pin, int ID, int R, int G, int B) int Pin: The Pin on your Arduino that the LED string is connected to int ID: What Hardware ID to use int R: The color code for Red (0-255) int G: The color code for Green (0-255) int B: The color code for Blue (0-255)
VISUALIZER(bool StartVisualizer, bool StopVisualizer, string ConfigName) bool StartVisualizer: Tells to start the visualizer bool StopVisualizer: Tells to stop the visualizer string ConfigName: The name of the.txt file to use as a visualizer configuration
GETVISUALIZERCONFIGS() Gets the name of all the current config files in the visualizer config folder.
AMBILIGHT(bool StartAmbilight, bool StopAmbilight, bool ShowOrHideBlocks, bool AutosetOffsets, string ConfigName) bool StartAmbilight: Tells to start the ambilight bool StopAmbilight: Tells to stop the ambilight bool ShowOrHideBlocks: Shows or hides the blocks is set to true bool AutosetOffsets: Outsets offsets string ConfigName: The name of the.txt file to use as a ambilight configuration
GETAMBILIGHTCONFIGS() Gets the name of all the current config files in the ambilight config folder.
ANIMATION(bool StartAnimation, bool StopAnimation, bool LoopState, string ConfigName bool StartAnimation: Tells to start the Animation bool StopAnimation: Tells to stop the Animation bool LoopState: Tells whether to loop the animation or not string ConfigName: The name of the.txt file to use as a Animation configuration
GETANIMATIONCONFIGS() Gets the name of all the current config files in the animations config folder.
INSTRUCTIONS(bool StartInstructions, bool StopInstructions, bool LoopState, string ConfigName bool StartInstructions: Tells to start the Instructions bool StopInstructions: Tells to stop the Instructions bool LoopState: Tells whether to loop the Instructions or not string ConfigName: The name of the.txt file to use as a Instructions configuration
GETINSTRUCTIONSCONFIGS() Gets the name of all the current config files in the instructions config folder.
CLICKBUTTON(string ButtonName, int ButtonID) string ButtonName: What button to press int ButtonID: If there are more than one buttons with this name, then the index can be selected here (however 0 is usually a normal value to use)
SETTEXTCONTROL(string TextboxName, int TextboxID, string Text) string TextboxName: What text box to edit int TextboxID: If there are more than one text box with this name, then the index can be selected here (however 0 is usually a normal value to use) string Text: The string to put into the text field
SETTACKBARCONTROL(string TrackbarName, int TrackbarID, int Value) string TrackbarName: What track bar to edit int TrackbarID: If there are more than one track bar with this name, then the index can be selected here (however 0 is usually a normal value to use) int Value: What value to set the track bar to
SETNUMERICCONTROL(string NumericUpDownName, int NumericUpDownID, int Value) string NumericUpDownName: What NumericUpDown to edit int NumericUpDownID: If there are more than one NumericUpDown with this name, then the index can be selected here (however 0 is usually a normal value to use) int Value: What value to set the NumericUpDown to
SETCOMBOBOXINDEXCONTROL(string ComboBoxName, int ComboBoxID, int Index) string ComboBoxName: What ComboBox to edit int ComboBoxID: If there are more than one ComboBox with this name, then the index can be selected here (however 0 is usually a normal value to use) int Index: What index to set the combo box to
SETCHECKBOXCONTROL(string CheckboxName, int CheckBoxID, int Index) string CheckboxName: What Checkbox to edit int CheckBoxID: If there are more than one Checkbox with this name, then the index can be selected here (however 0 is usually a normal value to use) int Index: What index to set the Checkbox to
GETCOMBOBOXLIST(string CheckboxName, int CheckBoxID) string CheckboxName: What Checkbox to edit int CheckBoxID: If there are more than one Checkbox with this name, then the index can be selected here (however 0 is usually a normal value to use)
GETTRACKBARVALUE(string TrackbarName, int TrackbarNameID) string TrackbarName: What Trackbar to edit int TrackbarID: If there are more than one Trackbar with this name, then the index can be selected here (however 0 is usually a normal value to use)
GETCHECKBOXSTATE(string CheckBoxName, int CheckBoxNameID) string CheckBoxName: What CheckBox to edit int CheckBoxID: If there are more than one CheckBox with this name, then the index can be selected here (however 0 is usually a normal value to use)

As well as some return codes (These are by default commented out, can be found under ServerAPISection.cs):

Return code Function
G Good, input, executing command
U Unknown command
B Error in input
Clone this wiki locally