Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
8c3b5526
Commit
8c3b5526
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
esp8266/scripts/neopixel.py: Remove test function from neopixel driver.
It takes up lots of room and isn't needed.
parent
1f7cec94
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
esp8266/scripts/neopixel.py
+4
-44
4 additions, 44 deletions
esp8266/scripts/neopixel.py
with
4 additions
and
44 deletions
esp8266/scripts/neopixel.py
+
4
−
44
View file @
8c3b5526
import
time
import
machine
# NeoPixel driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Damien P. George
from
esp
import
neopixel_write
class
NeoPixel
:
...
...
@@ -7,6 +8,7 @@ class NeoPixel:
self
.
pin
=
pin
self
.
n
=
n
self
.
buf
=
bytearray
(
n
*
3
)
self
.
pin
.
init
(
pin
.
OUT
,
pin
.
PULL_NONE
)
def
__setitem__
(
self
,
index
,
val
):
r
,
g
,
b
=
val
...
...
@@ -20,45 +22,3 @@ class NeoPixel:
def
write
(
self
):
neopixel_write
(
self
.
pin
,
self
.
buf
,
True
)
def
test
():
# put a neopixel strip on GPIO4
p
=
machine
.
Pin
(
4
,
machine
.
Pin
.
OUT
)
np
=
NeoPixel
(
p
,
8
)
n
=
np
.
n
# cycle
for
i
in
range
(
4
*
n
):
for
j
in
range
(
n
):
np
[
j
]
=
(
0
,
0
,
0
)
np
[
i
%
n
]
=
(
255
,
255
,
255
)
np
.
write
()
time
.
sleep_ms
(
25
)
# bounce
for
i
in
range
(
4
*
n
):
for
j
in
range
(
n
):
np
[
j
]
=
(
0
,
0
,
128
)
if
(
i
//
n
)
%
2
==
0
:
np
[
i
%
n
]
=
(
0
,
0
,
0
)
else
:
np
[
n
-
1
-
(
i
%
n
)]
=
(
0
,
0
,
0
)
np
.
write
()
time
.
sleep_ms
(
60
)
# fade in/out
for
i
in
range
(
0
,
4
*
256
,
8
):
for
j
in
range
(
n
):
if
(
i
//
256
)
%
2
==
0
:
val
=
i
&
0xff
else
:
val
=
255
-
(
i
&
0xff
)
np
[
j
]
=
(
val
,
0
,
0
)
np
.
write
()
# clear
for
i
in
range
(
n
):
np
[
i
]
=
(
0
,
0
,
0
)
np
.
write
()
test
()
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