Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Bamboosam

Member Since 09 Jan 2013
Offline Last Active Jan 21 2013 04:37 AM
-----

Posts I've Made

In Topic: Any chance of being able to speed up SPI - NP2?

20 January 2013 - 08:53 PM

Ok, Ill try that. Thank you :)


In Topic: Any chance of being able to speed up SPI - NP2?

20 January 2013 - 08:34 PM

Great job guys on the netduino though! Using Visual C# is next to heaven, too bad there is just too much over head.


In Topic: Any chance of being able to speed up SPI - NP2?

20 January 2013 - 08:30 PM

ok, I thought it had to do with SPI, I was hoping the NP2 @ 168mHz even though using .Net would be considerably faster than an Atmega @ 16mHz. Bummer


In Topic: Any chance of being able to speed up SPI - NP2?

20 January 2013 - 08:16 PM

The code is very simple right now, and I created the exact pattern on my arduino and it is noticeably slower on the NP2.  I've pretty much maxed out my last project using an Atmega 1284p @ 16mHz, so I am in the jump to a better processor to achieve more complex patterns. 

public static void LightStripSpi()

        {

            int i = 0;

            var spi = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE,

                false, 0, 0, false, true, 2000, SPI.SPI_module.SPI1));

           

            var colors = new byte[3 * 94];

         

            var zeros = new byte[3 * ((32 + 63) / 64)];

 

            byte r = 0;

            byte g = 0;

            byte b = 0;

            byte spin = 0;

 

            while (true)

            {

             

                // all pixels off

            for (int ix = 0; ix < colors.Length; ++ix) colors[ix] = (byte)(0x80 | 0);

 

            switch (i)

            {

                case 0: r = 127; b = 0; g = 0; break;

                case 1: r = 0; b = 127; g = 0; break;

                case 2: r = 0; b = 0; g = 127; break;

                case 3: r = 127; b = 0; g = 127; break;

                case 4: r = 0; b = 127; g = 127; break;

                case 5: r = 127; b = 127; g = 0; break;

                case 6: r = 127; b = 127; g = 127; break;

            }

 

                for (byte o = 0; o < 94; o+=47){

                for (byte e = 0; e < 4; e++)

                {

 

                    colors[(((o + e + spin) % 94) * 3) + 0] = (byte)(0x80 | r); //blue

                    colors[(((o + e + spin) % 94) * 3) + 1] = (byte)(0x80 | g); //red

                    colors[(((o + e + spin) % 94) * 3) + 2] = (byte)(0x80 | B); //green

 

                    colors[(((93 - (o + e + spin) % 94)) * 3) + 0] = (byte)(0x80 | r); //blue

                    colors[(((93 - (o + e + spin) % 94)) * 3) + 1] = (byte)(0x80 | g); //red

                    colors[(((93 - (o + e + spin) % 94)) * 3) + 2] = (byte)(0x80 | B); //green                  

                }            

                }

                spi.Write(colors);

                spi.Write(zeros);

                i++;

                i %= 7;

                spin++; spin %= 94;                

            }

        }

 

In Topic: Is it possible to create a windows forms application that will program the Ne...

17 January 2013 - 04:52 PM

Great, thanks guys. Dave: That is a great idea! I didn't realize that is possible. Does the ND+2 run slower doing it that way?


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.