Thanks jeremington!
nice to see you again:)
okay. I'll!
Cuz I didn't know 'Blink without delay" I made my way to come up with this.
It's my codes right now.
#include <DFPlayer_Mini_Mp3.h>
#include <SoftwareSerial.h>
SoftwareSerial mp3Serial(0, 1);
const int c1 = 12;
const int c2 = 13;
const int c3 = A0;
const int c4 = A1;
const int c5 = A2;
const int c6 = A3;
const int c7 = A4;
//왼쪽 모터들
const int c8 = 11;
const int c9 = 10;
const int c10 = 9;
const int c11 = 8;
const int c12 = 7;
const int c13 = 6;
const int c14 = 5;
//오른쪽 모터들
int flexSensor = A5;
void setup() {
Serial.begin(9600);
mp3Serial.begin(9600);
mp3_set_serial (mp3Serial);
delay(1);
mp3_set_volume (30);
pinMode(flexSensor, INPUT);
pinMode(c1, OUTPUT);
pinMode(c2, OUTPUT);
pinMode(c3, OUTPUT);
pinMode(c4, OUTPUT);
pinMode(c5, OUTPUT);
pinMode(c6, OUTPUT);
pinMode(c7, OUTPUT);
//왼쪽 모터들
pinMode(c8, OUTPUT);
pinMode(c9, OUTPUT);
pinMode(c10, OUTPUT);
pinMode(c11, OUTPUT);
pinMode(c12, OUTPUT);
pinMode(c13, OUTPUT);
pinMode(c14, OUTPUT);
//오른쪽 모터들
}
void loop() {
int flexVal;
flexVal = analogRead(flexSensor);
if (flexVal < 4) {
// 적게 올때, 숫자가 작음 / 구부러졋단뜻 / 혼자 씀
for (int i = 0; i < 40; ++i)
{
int randomMotorOne = "c + random(1, 15)"; //진동 오는 코인을 랜덤하게
int rainPowerOne = random(75, 125); //혼자 쓸때 진동의 세기
int rainCycleOne = random(150, 350); //혼자 쓸때 진동 오는 주기
digitalWrite(randomMotorOne, HIGH);
delay(rainPowerOne);
digitalWrite(randomMotorOne, LOW);
delay(rainCycleOne);
}
}
else {
// 많이 오기 시작, 숫자 큼 / 안구부러짐 / 둘이 씀
for (int i = 0; i < 20; ++i)
{
int randomMotorTwo = "c + random(1, 15)"; //진동 오는 코인을 랜덤하게
int rainPowerTwo = random(100, 40); //둘이 쓸때 진동의 세기
int rainCycleTwo = 350 - i * 10; //둘이 쓸때 진동 오는 주기
digitalWrite(randomMotorTwo, HIGH);
delay(rainPowerTwo);
digitalWrite(randomMotorTwo, LOW);
delay(rainCycleTwo);
}
//많이 옴 / 음악재생 / 커진 후 쭉 반복
mp3_play();
for (int i = 0; i < 1000; ++i)
{
int randomMotorThree = "c + random(1, 15)"; //진동 오는 코인을 랜덤하게
int rainPowerThree = random(100, 125); //둘이 쓸때 진동의 세기
int rainCycleThree = random(50, 100); //둘이 쓸때 진동 오는 주기
digitalWrite(randomMotorThree, HIGH);
delay(rainPowerThree);
digitalWrite(randomMotorThree, LOW);
delay(rainCycleThree);
}
}
Serial.println(flexVal);
}
I'm stuck in
int randomMotorOne = "c + random(1, 15)";
this parts. I know it's wrong cuz that isn't int.
But I don't know how 'randomMotorOne' can give me series of [c1, c3, c14, c11...] randomly 