View Single Post
  #13   Spotlight this post!  
Unread 17-03-2016, 01:42
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
Re: Help needed with algorithm

I am still waiting for ws2812b LEDs, but after a bit of a break and then practicing on direct PWM pins, I finally cleaned up logic enough for it to do almost what I want. Here is what I got so far:

PHP Code:
void loop() {
  
float inouttemp;
  
int i;
  for (
in = -piin pi 24in in pi 50)
  {
    for (
0<= 231)
    {
      
temp pi LED_Group i;
      if (
in >= -pi temp && in <= pi temp )
      {
        
out cos(in temp) * 2048 2047;
        
tlc.setPWM(iout);
        
tlc.write();
      }
    }
  }

LED_Group is for controlling how many LED to include in a wave
__________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
2017 FTC 11722 (Coach)
2016 FTC 10544 (Coach) Canadian Championship Finalist, Rockwell Collins Innovate Award.
2014 FRC 5064 (Mentor)
Reply With Quote