-
Notifications
You must be signed in to change notification settings - Fork 32
fix #3 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix #3 #11
Changes from 6 commits
44d169b
c3502b7
71d1a8d
481761e
8e40c31
5db757f
cfc45a8
1618d6b
46b3e86
195dcbc
3eb3475
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||||||||||||||||
| /* | ||||||||||||||||||||||
| Arduino LSM6DS3 - Accelerometer Tap | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| this code is to detect tap | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| using IMU.accelerationAvailable() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
aentinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
| */ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #include <Arduino_LSM6DS3.h> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| void setup() { | ||||||||||||||||||||||
| Serial.begin(9600); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while (!Serial); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while (!IMU.begin()) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Serial.println("Failed to initialize IMU!"); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
||||||||||||||||||||||
| while (!Serial); | |
| while (!IMU.begin()) { | |
| Serial.println("Failed to initialize IMU!"); | |
| while (!Serial); | |
| while (!IMU.begin()) { | |
| Serial.println("Failed to initialize IMU!"); |
Remove pointless blank lines.
per1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
per1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| float tapThreshold = 0.05 ; //0.05g acceleration in some direction is considered as tap. it can be change for the required sensitivity. | |
| float tapThreshold = 0.05; //0.05 g acceleration in some direction is considered as tap. it can be changed for the required sensitivity. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int down = 3 ; // signifing the direction of which is facing downward 1 for x axis ; 2 for y axis ; 3 for z axis; | |
| int down = 3; // signifying the direction which is facing downward: 1 for x axis; 2 for y axis; 3 for z axis |
Fix formatting and typo.
Why not make this a char so you can do this:
char down = 'z'; // the axis which is facing downward
per1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
tkhabia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove pointless blank lines.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ((y > tapThreshold || y < -tapThreshold) && down != 2 ) { | |
| if ((y > tapThreshold || y < -tapThreshold) && down != 2) { |
Fix formatting.
per1234 marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ((z > tapThreshold || z < -tapThreshold)&& down != 3 ) { | |
| if ((z > tapThreshold || z < -tapThreshold) && down != 3) { |
Fix formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove pointless blank lines.