#include <string.h>
#include <stdio.h>
void run()
{
for (int i = 4; i <= 13; i++) {
digitalWrite(i, HIGH);
delay(100);
digitalWrite(i, LOW);
}
for (int i = 12; i > 4; i--) {
digitalWrite(i, HIGH);
delay(100);
digitalWrite(i, LOW);
}
}
char ch;
char buf[100];
int c=0;
void setup() {
Serial.begin(115200);
Serial. print("Dj control - The Bits Master\n");
for (int i = 4; i <= 13; i++) {
pinMode(i, OUTPUT);
}
}
void loop() {
if(Serial.available())
{
ch=Serial.read();
Serial.print(ch);
if(ch!='\n')
{
buf[c]=ch;
buf[c+1]=0;
c++;
}
else
{
// Serial.print(buf);
c=0;
// terminate command
if(strstr(buf,"run")>0)
{
run();
}
memset(buf,100,0);
}
}
}