|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Originally Posted by comphappy
Yes, I am aware of that, but in this case the PWM is being driven with out any user input, should be ether 0 or 255, nothing in the middle.
|
I'm not sure I am following what the question is. If you have a PWM value that is going to be only one of two states, 0 or 255, then just test for one state. For example:
Code:
if (pwm03 > 127)
{
accumulator ++;
}
else
{
accumulator --;
}
I chose 127 just for simplicity.
Just as easily, you could test for the actual value.
Code:
if (pwm03 == 255)
{
accumulator ++;
}
else
{
accumulator --;
}
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
|