INPORT

From Smart Box
Revision as of 19:22, 6 October 2023 by Benryves (talk | contribs) (Created page with "== Syntax == INPORT == Description == The function INPORT returns the current ‘value’ of all digital sensors as a single number. Each digital sensor has a unique ‘value’ as shown below: * SENSOR 0 = 1 when it is on. * SENSOR 1 = 2 * SENSOR 2 = 4 * SENSOR 3 = 8 * SENSOR 4 = 16 * SENSOR 5 = 32 * SENSOR 6 = 64 * SENSOR 7 = 128 So if SENSORS 0,3 and 5 are ‘ON’ INPORT will return 41 (1+8+32) == Example == IF INPORT = 255 THEN PRINT "All sensors are on" ==...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Syntax[edit]

INPORT

Description[edit]

The function INPORT returns the current ‘value’ of all digital sensors as a single number. Each digital sensor has a unique ‘value’ as shown below:

  • SENSOR 0 = 1 when it is on.
  • SENSOR 1 = 2
  • SENSOR 2 = 4
  • SENSOR 3 = 8
  • SENSOR 4 = 16
  • SENSOR 5 = 32
  • SENSOR 6 = 64
  • SENSOR 7 = 128

So if SENSORS 0,3 and 5 are ‘ON’ INPORT will return 41 (1+8+32)

Example[edit]

IF INPORT = 255 THEN PRINT "All sensors are on"

Associated keywords[edit]