Digital Sensors

From Smart Box
Revision as of 03:30, 7 October 2023 by Benryves (talk | contribs) (Created page with "The range of digital sensors allow simple on / off conditions to be detected. The sensors are connected between the pairs of red and yellow digital sensor sockets on the top of the box. When the sensor is in its ‘On’ condition the indicator on the box will light. The Smart Move software can detect the condition of the switch as ‘On’ or ‘Off’ or alternatively ‘1’ or ‘0’. Both these Smart Move program lines are valid: IF SENSOR 1 IS ON THEN FORWARD A...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The range of digital sensors allow simple on / off conditions to be detected. The sensors are connected between the pairs of red and yellow digital sensor sockets on the top of the box. When the sensor is in its ‘On’ condition the indicator on the box will light. The Smart Move software can detect the condition of the switch as ‘On’ or ‘Off’ or alternatively ‘1’ or ‘0’. Both these Smart Move program lines are valid:

IF SENSOR 1 IS ON THEN FORWARD A
IF SENSOR 1 = 1 THEN FORWARD A

A Push Switch can be used as a manual input device. The switch is normally ‘Off’ and will be detected as ‘On’ when pressed.

A Tilt switch can be used to detect when an object has moved beyond a particular angle.

A Magnetic Switch will be ‘On’ when a magnet is close to the end.

Making your own sensors

Any device which completes a circuit between a red and yellow socket on Smart Box can be used as a digital sensor. This can be as simple as two contacts closing together. Switches can be manufactured using card and tin foil, pegs and drawing pins etc.

An example project

The following example uses three digital sensors and a buzzer to create a simple security system.

Sensors 0 and 1 are magnetic contact switches which will open as a door or window is opened. A push switch is connected to sensor 2 which is used to switch off the system. The Digital sensors can be ‘Labelled’ or given an alternative name using the LABEL command in Smart Move. This makes the sensors easier to identify. In the same way some of the Smart Move keywords can be changed. In this example the keyword OFF is changed to OPEN. The reference section gives more details.

Type in the following as direct commands

LABEL OFF open
LABEL SENSOR0 door
LABEL SENSOR1 window
LABEL SENSOR2 turnoff
LABEL OUTPUT0 buzzer

Type in all the procedures as shown then run the Alarm procedure.

Procedure: Alarm

REPEAT
IF DOOR IS OPEN THEN Soundalarm
IF WINDOW IS OPEN THEN Soundalarm
UNTIL TURNOFF IS ON
Stopalarm

Procedure: Soundalarm

SWITCH ON buzzer PULSE 50,50

Procedure: Stopalarm

SWITCH OFF buzzer