-1
我试图按照out1
中的公式来更改LED的亮度。我很确定有什么地方出了问题,因为它并没有真正改变它的亮度,它从来没有停止过亮。它应该基本上做一样的比罪恶的波浪,但不是罪,我尝试使用我的等式!LED亮度的多项式变化
const int LED = 11;
const int LED1 = 10;
const int LED2 = 9;
void setup()
{
}
void loop()
{
float in1, out1, out2, out3;
for (in1 = 0; in1 < 10; in1++)
{
out1 = 8.8 * pow(10,-4) * pow(in1,4) - 0.0034 * pow(in1,3) +0.37 * pow(in1,2) -6.7 *in1 +1.7 *pow(10,2);
//out2 = 1.207*pow(in1,4)-0.0011*pow(in1,3)+0.16*pow(in1,2)-5.5*in1+2,0763;
//out3 = 4.829*pow(in1,4)-0.034*pow(in1,3)+0.37*pow(in1,2)-6.7*in1+2,076;
analogWrite(LED,out1);
//delay(1);
//analogWrite(LED1,out2);
//analogWrite(LED2,out3);
}
analogWrite(LED,LOW);
/*analogWrite(LED,out1);
analogWrite(LED1,out2);
analogWrite(LED2,out3);
//analogWrite(LED1,LOW);*/
delay(500);
另外检查[图](http://www.wolframalpha.com/input/?i=8.8e-4+*+x^4+-+0.0034+*+x^3+%2B+ 0.37 + * + x^2 + - + 6.7 + * + x +%2B + 1.7e2,+ x +%3D + 0 + to + 10) - 我不确定在140-170的输出范围内人们可以看到LED亮度的差异。 – Lyth
这可能是可能的,但我如何操作我的功能,以便我可以看到差异。我也想知道为什么它永远不会减轻。 – gamma
out1,out2和out3连接到RGB LED的三个引脚? – TomServo