Skip to content

Commit 90ac8b3

Browse files
committed
add toNeoPixel() method
1 parent 6875488 commit 90ac8b3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/AdafruitIO_Data.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,17 @@ unsigned long AdafruitIO_Data::toUnsignedLong()
312312
#endif
313313
}
314314

315+
long AdafruitIO_Data::toNeoPixel()
316+
{
317+
if(! _value)
318+
return 0;
319+
320+
char rgb_string[9] = "0x";
321+
strncat(rgb_string, toChar() + 1, 6);
322+
323+
return strtol(rgb_string, NULL, 0);
324+
}
325+
315326
char* AdafruitIO_Data::toCSV()
316327
{
317328
char csv[150];

src/AdafruitIO_Data.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class AdafruitIO_Data {
6262
long toLong();
6363
unsigned long toUnsignedLong();
6464

65+
long toNeoPixel();
66+
6567
char* toCSV();
6668
char* charFromDouble(double d, int precision=6);
6769

0 commit comments

Comments
 (0)