Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos Motor SDFileSystem
Revision 3:dfb7bc3cb2f9, committed 2019-04-26
- Comitter:
- fulmerformal
- Date:
- Fri Apr 26 20:06:33 2019 +0000
- Parent:
- 2:3f0cf51fe1e3
- Commit message:
- updated;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3f0cf51fe1e3 -r dfb7bc3cb2f9 main.cpp --- a/main.cpp Fri Apr 19 06:09:53 2019 +0000 +++ b/main.cpp Fri Apr 26 20:06:33 2019 +0000 @@ -58,8 +58,8 @@ //Setup RGB led using PWM pins and class microphone mymicrophone(p16); RGBLed myRGBled(p25,p24,p23); //RGB PWM pins -Motor large(p21, p6, p5); // pins for large drum // pwm, fwd, rev -Motor small(p22, p8, p7); // pins for small drum +Motor small(p21, p30, p29); // pins for large drum // pwm, fwd, rev +Motor largex`(p22, p6, p5); // pins for small drum Serial blue(p28,p27); // pins for bluetooth module serial Serial pc(USBTX,USBRX); SDFileSystem sd(p11, p12, p13, p14, "sd"); @@ -76,11 +76,11 @@ FILE *nfp = fopen("/sd/sdtest1.txt", "r"); -float strikelength = .08; // amount of time in seconds that the motor will run when striking +float strikelength = .15; // amount of time in seconds that the motor will run when striking float bpm = 240.0; // bpm of recorded song, 240 bpm is nearing the fastest that we can go float intensity = 0.0; volatile int color = 0; -float recover = .08; +float recover = .15; float initial = .01; //void light_leds() { @@ -93,36 +93,36 @@ // Hit the small drum void small_hit(void) { //pc.printf("Small drum hit"); - myRGBled.write(1,0,0); + myRGBled.write(1,1,0); smallLED = 1; wait(.1); smallLED = 0; color = 2; small.speed(1.0); wait(strikelength); - small.speed(0.0); + small.speed(0); wait(initial); small.speed(-1.0); wait(recover); - small.speed(0.0); + small.speed(0); myRGBled.write(0,0,0); } // Hit large drum void large_hit(void) { //pc.printf("Large drum hit"); - myRGBled.write(0,1,0); + myRGBled.write(1,1,0); largeLED = 1; wait(.1); largeLED = 0; color = 1; large.speed(1.0); wait(strikelength); - large.speed(0.0); + large.speed(0); wait(initial); large.speed(-1.0); wait(recover); - large.speed(0.0); + large.speed(0); myRGBled.write(0,0,0); } @@ -137,14 +137,14 @@ small.speed(1.0); large.speed(1.0); wait(strikelength); - small.speed(0.0); - large.speed(0.0); + small.speed(0); + large.speed(0); wait(initial); small.speed(-1.0); large.speed(-1.0); wait(recover); - small.speed(0.0); - large.speed(0.0); + small.speed(0); + large.speed(0); myRGBled.write(0,0,0); } @@ -152,6 +152,8 @@ int main() { //pc.printf("Program Start"); + //small.speed(.5); + //large.speed(.5); if(nfp == NULL) { error("Could not open file for read\n"); }