'How to cast a boolean into a number in App Inventor?

When I toggle a switch in App Inventor, a number must be sent in Bluetooth Low Energy (BLE).

The problem is the following:
enter image description here

and I want to use the value inside a call to BLE:
enter image description here

The boolean is correct, the value sent is correct if it is set to a number. How to cast a boolean to a number then on AppInventor ? Any ideas ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source