-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ino
89 lines (68 loc) · 1.92 KB
/
main.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "Arduino.h"
#include "CustomServo.h"
#include "CustomButton.h"
CustomServo motor;
CustomButton sensor(A0);
void setup()
{
Serial.begin(9600);
Serial.print("STARTING ARDUINO SERIAL");
motor.attach(9);
motor.adjust(0);
}
void loop()
{
sensor.firstAction = firstAction;
sensor.secondAction = secondAction;
sensor.thirdAction = thirdAction;
sensor.binder();
}
//void move(String ease, float dur, float delta)
void firstAction(){
static unsigned int count = 0;
count++;
Serial.print("First Action Called___ : ");
Serial.println(count);
int time = 1750;
int top = 200;
int bottom = 10;
motor.move("easeInOutCubic", time, motor.current(), top);
motor.move("easeInOutCubic", time, top, bottom);
motor.adjust(0);
}
void secondAction(){
static unsigned int count = 0;
count++;
Serial.print("Second Action Called : ");
Serial.println(count);
int time = 200;
int top = 180;
int bottom = 120;
motor.move("easeInOutCubic", time, motor.current(), top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", time, bottom, top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", time, bottom, top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", time, bottom, top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", 800, bottom, 0);
motor.adjust(0);
}
void thirdAction(){
static unsigned int count = 0;
count++;
Serial.print("Third Action Called : ");
Serial.println(count);
int time = 600;
int top = 120;
int bottom = 40;
motor.move("easeInOutCubic", time, motor.current(), top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", time, bottom, top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", time, bottom, top);
motor.move("easeInOutCubic", time, top, bottom);
motor.move("easeInOutCubic", 800, bottom, 0);
motor.adjust(0);
}