Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Sebastián Collado Montañez
/
proyecto-micro
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
64718470
authored
Dec 14, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
servo test
parent
2a1b78df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
webserver.js
webserver.js
View file @
64718470
...
...
@@ -12,11 +12,14 @@ var RED = new Gpio(4, {mode: Gpio.OUTPUT});
var
GREEN
=
new
Gpio
(
17
,
{
mode
:
Gpio
.
OUTPUT
});
var
BLUE
=
new
Gpio
(
27
,
{
mode
:
Gpio
.
OUTPUT
});
//cierre maximo 1850
//apertura maxima 550
var
motor
=
new
Gpio
(
13
,
{
mode
:
Gpio
.
OUTPUT
}),
pulseWidth
=
1850
,
increment
=
-
100
;
// Valor de puerta cerrada 1850
// Valor de puerta abierta 560
// La amplitud de apertura es 1290
// Tiempo para la apertura: 10s
var
motor
=
new
Gpio
(
13
,
{
mode
:
Gpio
.
OUTPUT
});
var
pulseWidth
=
1850
;
var
increment
=
-
129
;
var
test
=
setInterval
(
function
()
{
motor
.
servoWrite
(
pulseWidth
);
...
...
@@ -24,9 +27,9 @@ var test = setInterval(function () {
pulseWidth
+=
increment
;
if
(
pulseWidth
>=
1850
)
{
increment
=
-
1
00
;
increment
=
-
1
29
;
}
else
if
(
pulseWidth
<=
550
)
{
increment
=
1
00
;
increment
=
1
29
;
}
},
1000
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment