-
• #2
Incase like me you had to Google to find out what a HC-SR04 is, its a an ultrasonic ranging module
-
• #3
Sorry, I forgot to add a link to Espruino module.
This is done now.
Incase like me you had to Google to find out what a HC-SR04 is, its a an ultrasonic ranging module
Sorry, I forgot to add a link to Espruino module.
This is done now.
In this small project, a HC-SR04 is used to support simple gestures.
There is already some information around ST04 in Espruino Documentation
First of all an gesture object needs to be created
Next the distance from SR04 is splitted into named areas.
Last not least assign callbacks for each type of gesture, which returns area, type of event and distance from SR04
Simply test this by moving your hand above SR04.
enter is fired after moving the hand into an area
leave is fired after leaving an area in whatever direction
click is fired if entering and leaving happen for the same are
move is fired if your hand moves inside an area and returns one more parameter, giving position in area in percent.
Some training will help to move your hand correctly inside an area, for example to hold your fingers close to each other finger(including thumb :-). For staying inside an area a coloured piece of paper will be helpful
Attached code gives the source for gesture-object.
1 Attachment