Go to Post Wait...you're supposed to have a driver? I guess I should have read past the Autonomous section in the manual :D - ASD20 [more]
Home
Go Back   Chief Delphi > Other > Math and Science
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-03-2016, 22:33
ArtemusMaximus's Avatar
ArtemusMaximus ArtemusMaximus is offline
Enginerd
FTC #11722
Team Role: Coach
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Canada
Posts: 248
ArtemusMaximus is a name known to allArtemusMaximus is a name known to allArtemusMaximus is a name known to allArtemusMaximus is a name known to allArtemusMaximus is a name known to allArtemusMaximus is a name known to all
Help needed with algorithm

Hello.
I am finally got to seriously play with Arduino boards and want to control bank of 24 LEDs. Idea at the moment is to create a single wave of light. I thought I was on the right track, but results are not what I expected.
Here is my code snippet:
Code:
  float in, out;

  for (in = 0; in < pi * 2; in = in + pi/500)
  {
    for (int i = 0; i <= 23; i = i + 1)
    {
      if (in > pi * 2 * i / 24 )
      {
        out = ((cos((in - pi) - (i*(pi*2)/24))+1)/2) *4095;
        tlc.setPWM(i, out);
        tlc.write();
      }
    }
  }
There must be a simple solution for this and it just escapes me.
Any help is appreciated
__________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
2017 FTC 11722 (Coach)
2016 FTC 10544 (Coach) Canadian Championship Finalist, Rockwell Collins Innovate Award.
2014 FRC 5064 (Mentor)
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:05.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi