simple gesture based on HC-SR04 #624
Unanswered
espruino-discuss2
asked this question in
Interfacing
Replies: 2 comments
-
Posted at 2014-11-09 by mhoneywill Incase like me you had to Google to find out what a HC-SR04 is, its a an ultrasonic ranging module |
Beta Was this translation helpful? Give feedback.
0 replies
-
Posted at 2014-11-09 by JumJum Sorry, I forgot to add a link to Espruino module. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted at 2014-11-09 by JumJum
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.
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions