Exemple #1
0
 private void ApplyStateAnode(StringBuilder sb, LEDState state, int tabs = 1)
 {
     sb.Append('\t', tabs);
     sb.Append("analogWrite(");
     sb.Append(RedPin);
     sb.Append(", 255-");
     sb.Append(state.Red);
     sb.Append(");\n");
     sb.Append('\t', tabs);
     sb.Append("analogWrite(");
     sb.Append(GreenPin);
     sb.Append(", 255-");
     sb.Append(state.Green);
     sb.Append(");\n");
     sb.Append('\t', tabs);
     sb.Append("analogWrite(");
     sb.Append(BluePin);
     sb.Append(", 255-");
     sb.Append(state.Blue);
     sb.Append(");\n");
     sb.Append('\t', tabs);
     sb.Append("digitalWrite(");
     sb.Append(CommonPin);
     sb.Append(", HIGH);\n");
     sb.Append('\t', tabs);
     sb.Append("delay(");
     sb.Append(state.Duration);
     sb.Append(");\n");
 }
Exemple #2
0
 public void ApplyState(StringBuilder sb, LEDState state, int tabs = 1)
 {
     if (Anode)
     {
         ApplyStateAnode(sb, state, tabs);
     }
     else
     {
         ApplyStateCathode(sb, state, tabs);
     }
 }