Contents

Switch



The switch transmits information to the microcontroller about one of the two fixed positions: on or off. Switch fixes its position unlike the buttons. To change the state of the switch must be to move his slider or press on the necessary side of the switch.

Data


DataTypeValues
Switch positionunsigned char0 - OFF (left position)
1 - ON (right position)

Settings

Settings of switch allow to specify the different values:

  • Variable name - name of the switch and the variable in the source code for the microcontroller, allow to set a name for the variable of C rules.
  • Caption in "ON" - set the caption the switch position ON. The default is "ON" - included. Allowed to ask in any language.
  • Caption in "OFF" - set the caption the switch position OFF. The default is "OFF" - included. Allowed to ask in any language.
  • PIN connected - You can specify what pin of controller connect this switch, or no connect it. If button is connected to pin, this will generate additional code to control the output of the microcontroller by this switch.

Code example

A common example shows how to check the current status of the switch is on or off:

if (RemoteXY.switch_1!=0) { /* switch on */ } else { /* switch off */ }

The following example shows how you can control output pin of the microcontroller with the number PIN_SWITCH using control - switch.

Code for Arduino IDE:

if (RemoteXY.switch_1!=0) digitalWrite(PIN_SWITCH, HIGH); else digitalWrite(PIN_SWITCH, LOW);