diff --git a/RMCS2301 and RMCS2004/README.md b/RMCS2301 and RMCS2004/README.md new file mode 100644 index 0000000..f2a9b9a --- /dev/null +++ b/RMCS2301 and RMCS2004/README.md @@ -0,0 +1 @@ +##Motor Driver RMCS2301 with Plantery Geared Motor RMCS2004 diff --git a/RMCS2301 and RMCS2004/sketch_jan15a/sketch_jan15a.ino b/RMCS2301 and RMCS2004/sketch_jan15a/sketch_jan15a.ino new file mode 100644 index 0000000..b49af97 --- /dev/null +++ b/RMCS2301 and RMCS2004/sketch_jan15a/sketch_jan15a.ino @@ -0,0 +1,39 @@ +#define Pulse 8 +#define Dir 9 + +double delay_Micros = 2000; +long delay_Micros2= 2000000; + +long currentMicros = 0; +long previousMicros = 0; +long previousMicros2 = 0; +long startTime = micros(); +double k = 0.2; +double a = 5; + +void setup() { + pinMode(Pulse,OUTPUT); + pinMode(Dir,OUTPUT); + digitalWrite(Dir,LOW); + Serial.begin(9600); + +} +void loop() +{ + currentMicros = micros(); +if(currentMicros - previousMicros2 >= delay_Micros2){ + previousMicros2 = currentMicros; + delay_Micros = 2000*pow(a,-k*(micros()-startTime)/1000000); + Serial.println(delay_Micros); + } +if(currentMicros - previousMicros >= delay_Micros) +{ + previousMicros = currentMicros; + + digitalWrite(Pulse,HIGH); + delayMicroseconds(delay_Micros); + digitalWrite(Pulse,LOW); + } + +} +