File tree Expand file tree Collapse file tree
examples/Basics/FactoryTest/ATOM_LITE Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #include < M5Atom.h>
1+ #include < M5Atom.h>
22#include < Adafruit_NeoPixel.h>
33
44#define PIN 27 // 定义NeoPixel的控制引脚
@@ -14,24 +14,6 @@ void setup() {
1414 pixels.begin (); // Init the NeoPixel library. 初始化NeoPixel库
1515}
1616
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-
3517// Input a value 0 to 255 to get a color value.
3618// The colours are a transition r - g - b - back to r.
3719uint32_t Wheel (byte WheelPos) {
@@ -46,3 +28,21 @@ uint32_t Wheel(byte WheelPos) {
4628 WheelPos -= 170 ;
4729 return pixels.Color (WheelPos * 3 , 255 - WheelPos * 3 , 0 );
4830}
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