Stap 4: Aurduino
Gewoon downloaden van de onderstaande code, en uploaden naar je arduino.Const int LEDone = 9;
Const int LEDtwo = 11;
Const int LEDthree = 10;
Const int LEDfour = 5;
Const int LEDfive = 6;
Const int LEDsix = 3;
int currentPin = 0;
int helderheid = 0;
VOID Setup {}
Serial.begin(9600);
pinMode (LEDone, uitvoer);
pinMode (LEDtwo, uitvoer);
pinMode (LEDthree, uitvoer);
pinMode (LEDfour, uitvoer);
pinMode (LEDfive, uitvoer);
pinMode (LEDsix, uitvoer);
}
void loop {}
if(Serial.available() > 0) {}
int inByte = Serial.read();
Serial.write(inByte);
Als (inByte == 'a') {}
currentPin = LEDone;
}
Als (inByte == 'b')
{currentPin = LEDtwo;}
Als (inByte == 'c')
{currentPin = LEDthree;}
Als (inByte == had') {}
currentPin = LEDfour;
}
Als (inByte == 'e')
{currentPin = LEDfive;}
Als (inByte == 'f')
{currentPin = LEDsix;}
Als (inByte > = 0 & & inByte < = 255) {}
helderheid = inByte;
analogWrite (currentPin, helderheid);
}
}
}
Waarschijnlijk zul je om de informatie van de haven in MAX op het bestand gaf ik u om de arduino te praten met MAX te wijzigen. Andere wijze moet u goed om te gaan.