File tree Expand file tree Collapse file tree 1 file changed +19
-19
lines changed
examples/Basics/FactoryTest/ATOM_LITE Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change 1
- #include < M5Atom.h>
1
+ #include < M5Atom.h>
2
2
#include < Adafruit_NeoPixel.h>
3
3
4
4
#define PIN 27 // 定义NeoPixel的控制引脚
@@ -14,24 +14,6 @@ void setup() {
14
14
pixels.begin (); // Init the NeoPixel library. 初始化NeoPixel库
15
15
}
16
16
17
- void loop () {
18
- rainbow (20 );
19
- }
20
-
21
- void rainbow (uint8_t wait) {
22
- uint16_t i, j;
23
-
24
- for (j = 0 ; j < 256 ; j++) {
25
- for (i = 0 ; i < pixels.numPixels (); i++) {
26
- pixels.setPixelColor (i, Wheel ((i + j) & 255 ));
27
- while (M5.Btn .read () == 1 )
28
- ;
29
- }
30
- pixels.show ();
31
- delay (wait);
32
- }
33
- }
34
-
35
17
// Input a value 0 to 255 to get a color value.
36
18
// The colours are a transition r - g - b - back to r.
37
19
uint32_t Wheel (byte WheelPos) {
@@ -46,3 +28,21 @@ uint32_t Wheel(byte WheelPos) {
46
28
WheelPos -= 170 ;
47
29
return pixels.Color (WheelPos * 3 , 255 - WheelPos * 3 , 0 );
48
30
}
31
+
32
+ void rainbow (uint8_t wait) {
33
+ uint16_t i, j;
34
+
35
+ for (j = 0 ; j < 256 ; j++) {
36
+ for (i = 0 ; i < pixels.numPixels (); i++) {
37
+ pixels.setPixelColor (i, Wheel ((i + j) & 255 ));
38
+ while (M5.Btn .read () == 1 )
39
+ ;
40
+ }
41
+ pixels.show ();
42
+ delay (wait);
43
+ }
44
+ }
45
+
46
+ void loop () {
47
+ rainbow (20 );
48
+ }
You can’t perform that action at this time.
0 commit comments