2532
Dependencies: QEI WS2812 PixelArray DFPlayerMini MODSERIAL PCA9685_ pca9685
Diff: main.cpp
- Revision:
- 5:cec7f85ce6c4
- Parent:
- 4:2f4d485ebe58
- Child:
- 6:4b007c7f0b7a
diff -r 2f4d485ebe58 -r cec7f85ce6c4 main.cpp --- a/main.cpp Sat Jun 22 17:57:41 2019 +0000 +++ b/main.cpp Mon Jun 24 15:25:36 2019 +0000 @@ -45,10 +45,10 @@ const uint8_t sensormap[16] = {0,1,2,3,4,5,10,7,8,9,6,11}; //const float actionstime[16]={5,5,5,5,5,5,5,5,2,5,5,5,5,5,5,5}; const Action actions[16]= {MLIT,MUS,OPEN,OPEN,KACH,OPEN,OPEN,OPEN,SLOW,OPEN,KACH,OPEN}; -const float actionstime[16] = {5, 5, 5, 5, 5, 5, 5, 5, 2, 5, 5, 5, 5, 5, 5, 5}; -const uint8_t servoLimitsStart[16]= {20, 85, 30, 40, 0, 20, 155, 105, 150, 45, 75, 130, 0, 0, 0, 0}; -const uint8_t servoLimitsCenter[16]={40, 110, 30, 40, 0, 20, 155, 105, 150, 45, 85, 130, 0, 0, 0, 0}; -const uint8_t servoLimitsEnd[16]= {60, 135, 50, 130, 180, 140, 70, 75, 40, 130, 95, 50, 180, 180, 180, 180}; +const float actionstime[16] = {5, 5, 5, 5, 7, 3, 5, 5, 2, 5, 7, 6, 5, 5, 5, 5}; +const uint8_t servoLimitsStart[16]= {20, 85, 27, 35, 0, 23, 155, 106, 150, 45, 80, 136, 0, 0, 0, 0}; +const uint8_t servoLimitsCenter[16]={31, 108, 27, 35, 0, 23, 155, 106, 150, 45, 85, 136, 0, 0, 0, 0}; +const uint8_t servoLimitsEnd[16]= {40, 135, 45, 90, 180, 90, 70, 75, 40, 120, 90, 55, 180, 180, 180, 180}; volatile int lastpos=0; @@ -82,7 +82,7 @@ mp3.mp3_play(id+1); while(at.read()<time) { - setservo(id,servoLimitsCenter[id]+sin(at.read())*(servoLimitsEnd[id]-servoLimitsStart[id])); + setservo(id,servoLimitsCenter[id]+sin(at.read()*2)*(servoLimitsEnd[id]-servoLimitsStart[id])); wait(0.03); } setservo(id,servoLimitsCenter[id]); @@ -97,13 +97,19 @@ while(at.read()<time) { - setservo(id2,servoLimitsCenter[id2]+(1-sin(at.read()*3))*(servoLimitsEnd[id2]-servoLimitsStart[id2])/2); - setservo(id1,servoLimitsCenter[id1]+sin(at.read()*3)*(servoLimitsEnd[id1]-servoLimitsStart[id1])/2); + //setservo(id2,servoLimitsCenter[id2]+(1-sin(at.read()*3))*(servoLimitsEnd[id2]-servoLimitsStart[id2])/2); + setservo(id2,servoLimitsCenter[id2]+sin(at.read()*3)*(servoLimitsEnd[id2]-servoLimitsStart[id2])/2); + + setservo(id1,servoLimitsCenter[id1]+cos((at.read()*3)+1)*(servoLimitsEnd[id1]-servoLimitsStart[id1])/2); wait(0.03); + + } + setservo(id1,servoLimitsCenter[id1]+1); + setservo(id2,servoLimitsCenter[id2]-1); + wait(1); setservo(id1,servoLimitsCenter[id1]); setservo(id2,servoLimitsCenter[id2]); - } void open(int id,float time)