아두이노 예제) LED 속도 가속 또는 랜덤화 하기 + 시리얼 통신까지
// 시리얼 통신 속도를 9600으로 설정하고 Serial.println(출력변수값) 으로 하면 된다.
int dspeed = 50;
int value;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop()
{
dspeed = dspeed + 1;
if(dspeed > 500)
{
dspeed = 0;
}
Serial.println(dspeed);
digitalWrite(13, HIGH); // set the LED on
delay(dspeed); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(dspeed); // wait for a second
}