FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ayush Agarwal
IDP
Commits
a246d2d2
Commit
a246d2d2
authored
3 years ago
by
ayush1301
Browse files
Options
Downloads
Patches
Plain Diff
Metal detect
parent
3e66a8d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/main.ino
+7
-0
7 additions, 0 deletions
main/main.ino
with
7 additions
and
0 deletions
main/main.ino
+
7
−
0
View file @
a246d2d2
...
@@ -43,6 +43,11 @@ float US_distance_avg;
...
@@ -43,6 +43,11 @@ float US_distance_avg;
//Metal Detector
//Metal Detector
int
metal_detector
=
1
;
int
metal_detector
=
1
;
int
metal_float_counter
=
0
;
#define metal_floating_avg_num 100
float
metal_avg
=
0
;
float
metal_vals
[
metal_floating_avg_num
]
=
{
0
};
//Servo
//Servo
#define servo_position 180
#define servo_position 180
...
@@ -217,6 +222,8 @@ void update_IR_vals() {
...
@@ -217,6 +222,8 @@ void update_IR_vals() {
void
update_metal_detector
()
{
void
update_metal_detector
()
{
unsigned
long
new_val
=
pulseIn
(
metal_detector
,
HIGH
);
unsigned
long
new_val
=
pulseIn
(
metal_detector
,
HIGH
);
float
new_val_Hz
=
1000.0
/
new_val
;
metal_avg
=
floating_average
(
&
metal_float_counter
,
metal_vals
,
metal_avg
,
new_val_Hz
,
metal_floating_avg_num
);
}
}
void
check_push_button
(
Adafruit_DCMotor
*
motors
[])
{
void
check_push_button
(
Adafruit_DCMotor
*
motors
[])
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment