Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VizBlocksFramework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Design Informatics
VizBlocks
VizBlocksFramework
Commits
1975fd9a
Commit
1975fd9a
authored
5 years ago
by
Dave Murray-Rust
Browse files
Options
Downloads
Patches
Plain Diff
Added an example to show multiple servos for the 4 channel ball dropper
parent
e5ee4616
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/MultipleServos/MultipleServos.ino
+59
-0
59 additions, 0 deletions
examples/MultipleServos/MultipleServos.ino
with
59 additions
and
0 deletions
examples/MultipleServos/MultipleServos.ino
0 → 100644
+
59
−
0
View file @
1975fd9a
#include
<Servo.h>
#include
<WallVis.h>
WallVis
node
(
"new001"
,
// Our ID
"WallVisNet"
,
//Wifi Access Point
"wallvisAP"
,
//WiFi Password
"192.168.4.1"
,
//IP address of Node RED server
1883
//Port for Node RED server
);
// Set up the servo we will use
Servo
s1
=
Servo
();
Servo
s2
=
Servo
();
Servo
s3
=
Servo
();
Servo
s4
=
Servo
();
void
setup
()
{
// Attach the servo to the right pin on the board
s1
.
attach
(
D1
);
s2
.
attach
(
D2
);
s3
.
attach
(
D3
);
s4
.
attach
(
D4
);
s1
.
write
(
0
);
s2
.
write
(
0
);
s3
.
write
(
0
);
s4
.
write
(
0
);
//Get the serial port ready
Serial
.
begin
(
115200
);
//Add in a behaviour that just goes to a certain angle, with the default name 'goto'
node
.
add
(
new
ServoGoto
(
s1
,
"goto1"
)
);
node
.
add
(
new
ServoGoto
(
s2
,
"goto2"
)
);
node
.
add
(
new
ServoGoto
(
s3
,
"goto3"
)
);
node
.
add
(
new
ServoGoto
(
s4
,
"goto4"
)
);
//Add in a behaviour that rotates from 0 to 180 and back again (e.g. dropping a ball trustball style)
node
.
add
(
new
RotateReturn
(
s1
,
"drop1"
,
1
,
500
,
3
,
175
)
);
node
.
add
(
new
RotateReturn
(
s2
,
"drop2"
,
1
,
500
,
3
,
175
)
);
node
.
add
(
new
RotateReturn
(
s3
,
"drop3"
,
1
,
500
,
3
,
175
)
);
node
.
add
(
new
RotateReturn
(
s4
,
"drop4"
,
1
,
500
,
3
,
175
)
);
//Initialise the whole infrastructure
node
.
set_wifi
(
false
);
node
.
init
();
}
void
loop
()
{
//Should be all we have to do
node
.
vis_loop
();
}
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