Proximity

You can have up to 4 proximity sensors

Config commands

proximity config [(info)]; // print config info
proximity config enable [(yes)|no];
proximity config remove; // removes the current config, sets to enable=false;
proximity config default; // removes the current then sets the default configuration.
proximity config clear; // clears current event flags, re initialises.
proximity[n] config smart [value]; // change smart change to [value] While doing smart streaming a change must be greater than this generate output. Default is 5

The default configuration is

{“config”:”Proximity”,”Num”:0,”Enabled”:1,”Pin”:36,”CutOff”:20}
{“config”:”Proximity”,”Num”:1,”Enabled”:1,”Pin”:39,”CutOff”:20}

proximity[n] config set [CUTTOFF(80)] [PIN]; // note if pin is not entered, it isn’t changed. cutoff is 20-80

ie
proximity0 config set 20 35;
proximity config enable yes;

Commands
proximity [(read)]; // does a read;
ie {“Proximity”:[[4,1],[0,1],[100,0],[100,0]]} returned. returns range first from 0-100 then 0/1- 1 means something is close, 0 means nothing is. In order of ‘n’

proximity stop [(on)|off]; // turn the wheel auto stop (when going from 0 to 1) on or off. Doesn’t survive reboot.
proximity events [(on)|off] ; // turn doing events on or off. Default is on. Is always turned on at reboot. Min time value is 50ms
proximity update [TIMEMS(100)]; // update time for events/error checking. Default is 100ms. Min is 50ms.
proximity stream [(on)|off] [TIMEMS(100)]; // sets the streaming on off, and interval. Default is 100. Min allowed is 50msec.

you can use ‘prox’ instead of ‘proximity’ in all of the above.

Events

#define ebEVENT_PROXIMITY_0_ON 44
#define ebEVENT_PROXIMITY_0_OFF 45
#define ebEVENT_PROXIMITY_1_ON 46
#define ebEVENT_PROXIMITY_1_OFF 47
#define ebEVENT_PROXIMITY_2_ON 48
#define ebEVENT_PROXIMITY_2_OFF 49
#define ebEVENT_PROXIMITY_3_ON 50
#define ebEVENT_PROXIMITY_3_OFF 51
#define ebEVENT_WHEELS_STOPPED_PROXIMITY 52

ie
{“Proximity”:[[6,1],[1,1],[79,1],[100,0]]}
{“evt”:48,”i”:”Proximity 2 On”}
{“Proximity”:[[6,1],[1,1],[100,0],[100,0]]}
{“evt”:49,”i”:”Proximity 2 Off”}