Arduino 5 - jas LED

From DT^2
Revision as of 11:33, 29 July 2019 by Palo (talk | contribs)
Jump to: navigation, search
int jas;

void setup() {
  pinMode(11, OUTPUT);
  Serial.begin(9600);
  jas = 255;
}

void loop() {
  if (Serial.available())
  {
    char c = Serial.read();
    if (c == '+') 
       if (jas < 255) jas++;
    if (c == '-')
       if (jas > 0) jas--;
  }
  analogWrite(11, jas);   
}