The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Teensy and FloraPixel v1

by winhack on Sun Feb 24, 2013 11:48 am

Hey all,

I am trying to connect up a FloraPixel to a Teensy++ 2.0. I can write and compile .C projects using make for the Teensy and that works just fine (I can blink it's onboard light the way I want to). When I switch to the Arduino IDE environment (after putting the Teensy hardware files in 1.0.3 as the pjrc website describes), I cannot seem to get the Teensy to work with the FloraPixel. I am sure it has something to do with the header files not being correct for the different AVR hardware (non-Flora).

I would be fine just using C or C++ for the Teensy, but I cannot seem to figure out which .h files are needed or which changes those .h files would need in order to work correctly together. Has anyone tried this already and succeeded? Can anyone point me in the right direction?
winhack
 
Posts: 3
Joined: Wed May 30, 2012 9:48 pm

Re: Teensy and FloraPixel v1

by adafruit_support_mike on Sun Feb 24, 2013 10:15 pm

The Adafruit library file and header (plus an example file) live at gitHub: https://github.com/adafruit/Adafruit-Fl ... el-Library

The code is C++, but the header does include a few other Arduino-specific headers. Fair warning, the code that talks to the Pixel is written in assembler. That probably won't port to another architecture, but at least you'll be able to see all the gory details of how the Arduino talks to the Pixel.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 8586
Joined: Thu Feb 11, 2010 1:51 pm

Re: Teensy and FloraPixel v1

by winhack on Sun Feb 24, 2013 10:51 pm

Hi mstone,

I think I have that code already, but from what I can tell, it seems to be geared towards the Flora as the microcontroller, not another device. The Teensy++ 2.0 is a different Atmel chip (the at90usb1286), but it has all the plugins/library/samples for the Arduino IDE. I will try again to can do to make that work.

I also downloaded the Adafruit WS2801 library, which from my reading of the website and the various tutorial pages, is similar to what is needed to control the pixel, but there seems to be at least one major difference. The pixels in the WS2801 tutorial require 4 wires, whereas it seems that the FloraPixel only needs 3.

Just to start out, I am just trying to blink the pixel on and off, not even worried about color yet. I will keep searching around and trying the code until I get figure out what I need to do. Maybe it's the wrong pins...I don't know.

Thank you for your help.
winhack
 
Posts: 3
Joined: Wed May 30, 2012 9:48 pm

Re: Teensy and FloraPixel v1

by winhack on Sun Feb 24, 2013 11:32 pm

Got it working. I needed to make one change and fix something.

For the change, I needed to change a line of code in the Adafruit_FloraPixel.h file from:

Code: Select all | TOGGLE FULL SIZE
#elif defined(__AVR_ATmega32U4__)

to
Code: Select all | TOGGLE FULL SIZE
#elif defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__)


After making that change, I also found that I needed to clip the aligator clips a lot more carefully as they were clearly shorting something on the underside of the pixel that was not apparently to me before.

After that code change and fixing my mistake, it worked just fine.
winhack
 
Posts: 3
Joined: Wed May 30, 2012 9:48 pm

Re: Teensy and FloraPixel v1

by adafruit_support_mike on Mon Feb 25, 2013 3:42 pm

winhack wrote: The Teensy++ 2.0 is a different Atmel chip (the at90usb1286), but it has all the plugins/library/samples for the Arduino IDE.

Oh, that's right.. I ordered a Teensy3 recently. That's an ARM platform, and it stuck in my head.

winhack wrote:Got it working. I needed to make one change and fix something.

Good catch on the #define. I'll have to remember that solution for future reference.

I'm glad to hear you got it working.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 8586
Joined: Thu Feb 11, 2010 1:51 pm