neopixels

Dependencies:   mbed NeoStrip

Files at this revision

API Documentation at this revision

Comitter:
jasonberry
Date:
Thu Feb 04 14:03:17 2021 +0000
Parent:
0:f38492690f0e
Commit message:
neopixels

Changed in this revision

NeoStrip.lib Show annotated file Show diff for this revision Revisions of this file
gt.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r f38492690f0e -r a9f32c0c835d NeoStrip.lib
--- a/NeoStrip.lib	Wed Mar 12 18:41:42 2014 +0000
+++ b/NeoStrip.lib	Thu Feb 04 14:03:17 2021 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/aswild/code/NeoStrip/#9f237b11f0a8
+http://mbed.org/users/aswild/code/NeoStrip/#f531a2be180d
diff -r f38492690f0e -r a9f32c0c835d gt.h
--- a/gt.h	Wed Mar 12 18:41:42 2014 +0000
+++ b/gt.h	Thu Feb 04 14:03:17 2021 +0000
@@ -1,12 +1,14 @@
-/**** gt.h ****/
-
-const int gt_img[] = {
-	0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x122446, 0x122446, 0x122446, 
-	0xffff00, 0xffff00, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 
-	0xffff00, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 
-	0xffff00, 0x122446, 0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 
-	0xffff00, 0xffff00, 0x122446, 0x122446, 0xffff00, 0x122446, 0xffff00, 0x122446, 
-	0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x122446, 0xffff00, 0x122446, 
-	0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0xffff00, 0x122446, 
-	0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0xffff00, 0x122446};
+/**** gt.h ****/
 
+const int gt_img[] = {
+	0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x122446, 0x122446, 0x122446, 
+	0xffff00, 0xffff00, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 
+	0xffff00, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 
+	0xffff00, 0x122446, 0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 
+	0xffff00, 0xffff00, 0x122446, 0x122446, 0xffff00, 0x122446, 0xffff00, 0x122446, 
+	0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x122446, 0xffff00, 0x122446, 
+	0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0xffff00, 0x122446, 
+	0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0x122446, 0xffff00, 0x122446};
+
+const int test_img[] = {
+	0x122446, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x122446, 0x122446, 0x122446};
\ No newline at end of file
diff -r f38492690f0e -r a9f32c0c835d main.cpp
--- a/main.cpp	Wed Mar 12 18:41:42 2014 +0000
+++ b/main.cpp	Thu Feb 04 14:03:17 2021 +0000
@@ -1,54 +1,113 @@
 /*
- * Adafruit NeoPixel 8x8 matrix example
+ * Adafruit NeoPixel example
  *
  * This program displays a couple simple patterns on an 8x8 NeoPixel matrix.
  *
- * 3 buttons are used for DigitalIns, 2 control the brightness up and down,
- * and the third switches patterns
  */
 
 #include "mbed.h"
 #include "NeoStrip.h"
 #include "gt.h"
 
-#define N 64
+#define N 5  //number of leds
+
+
 #define PATTERNS 3
 
-int hueToRGB(float h);
-void pattern0();
-void pattern1();
-void pattern2();
+//int hueToRGB(float h);
+//void pattern0();
+//oid pattern1();
+//void pattern2();
 
 // array of function pointers to the various patterns
-void (*patterns[])(void) = {&pattern0, &pattern1, &pattern2};
+//void (*patterns[])(void) = {&pattern0, &pattern1, &pattern2};
 
-NeoStrip strip(p18, N);
-DigitalIn b1(p20); // brightness up
-DigitalIn b2(p19); // brightness down
-DigitalIn b3(p21); // next pattern
+NeoStrip strip(p25, N);
+//DigitalIn b1(p20); // brightness up
+//DigitalIn b2(p19); // brightness down
+//DigitalIn b3(p22); // next pattern
 
 // timer used for debugging
 Timer timer;
 
 int main()
 {
-	b1.mode(PullDown);
-	b2.mode(PullDown);
-	b3.mode(PullDown);
+//	b1.mode(PullDown);
+//	b2.mode(PullDown);
+//	b3.mode(PullDown);
 	
-	int pattern = 0;
-	float bright = 0.2;	// 20% is plenty for indoor use
-	bool b3o = b3;		// old copy of button 3 to poll for changes
+	//int pattern = 0;
 
+	//bool b3o = b3;		// old copy of button 3 to poll for changes
+	//int p = 0;
+	   
+	   
+    float bright = 0.2;	// 20% is plenty for indoor use
+    int color = 0x122446; //0xFF0000;  //red
+     
 	strip.setBrightness(bright);	// set default brightness
 	
-	while (true)
+	while(true)
+	{
+    //strip.setPixels(0, N, test_img);
+    strip.clear();
+    strip.write();
+    wait_ms(1000);
+    strip.setPixel(0,color);
+    strip.write();
+    wait_ms(1000);
+    
+    strip.setPixel(1,color);
+    strip.write();
+    wait_ms(1000);
+    
+    strip.setPixel(2,color);
+    strip.write();
+    wait_ms(1000);
+    
+    strip.setPixel(3,color);
+    strip.write();
+    wait_ms(1000);
+    
+    strip.setPixel(4,color);
+    strip.write();
+    wait_ms(1000);
+    
+	}
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	
+	/*while (true)
 	{
 		timer.reset(); // use a timer to measure loop execution time for debugging purposes
 		timer.start(); // for this application, the main loop takes approximately 3ms to run
 
 		// button 1 increases brightness
-		if (b1 && bright < 1)
+		if(0) //(b1 && bright < 1)
 		{
 			bright += 0.01;
 			if (bright > 1)
@@ -57,7 +116,7 @@
 		}
 
 		// button 2 decreases brightness
-		if (b2 && bright > 0)
+		if (0)//(b2 && bright > 0)
 		{
 			bright -= 0.01;
 			if (bright < 0)
@@ -66,7 +125,7 @@
 		}
 		
 		// button 3 changes the pattern, only do stuff when its state has changed
-		if (b3 != b3o)
+		if (0)//(b3 != b3o)
 		{
 			if (b3 && ++pattern == PATTERNS)
 				pattern = 0;
@@ -84,10 +143,10 @@
 		
 		wait_ms(10);
 	}
-}
+}*/
 
 // pattern0 displays a static image
-void pattern0()
+/*void pattern0()
 {
 	strip.setPixels(0, N, gt_img);
 }
@@ -177,4 +236,4 @@
 
 	return (R << 16) | (G << 8) | B;
 }
-
+*/
diff -r f38492690f0e -r a9f32c0c835d mbed.bld
--- a/mbed.bld	Wed Mar 12 18:41:42 2014 +0000
+++ b/mbed.bld	Thu Feb 04 14:03:17 2021 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file