Evan Zhang
/
StepperMotorSong
bleh
Diff: main.cpp
- Revision:
- 1:58fce6cd1c51
- Parent:
- 0:6cc2c1f459f1
--- a/main.cpp Sun Apr 25 20:02:35 2021 +0000 +++ b/main.cpp Sun Apr 25 22:45:01 2021 +0000 @@ -29,29 +29,32 @@ Ticker t1; int main() { - float note1 = 1.0/(NOTE_A4*2); - float note2 = 1.0/(NOTE_CS5*2); - float note2m = 1.0/(NOTE_C5*2); - float note3 = 1.0/(NOTE_E5*2); - t.attach(&f, &Flipper::flip, note1); // the address of the object, member function, and interval - t1.attach(&f1, &Flipper::flip, note2); + //float note1 = 1.0/(NOTE_A4*2); + //float note2 = 1.0/(NOTE_CS5*2); + //float note2m = 1.0/(NOTE_C5*2); + //float note3 = 1.0/(NOTE_E5*2); + + //parse length here + int length = 100; + + float notes1 [length]; + float durs1 [length]; + + // copy above for more lines of notes + + //parsing of notes, needs to partse + + //parsing of durs + + //t.attach(&f, &Flipper::flip, note1); // the address of the object, member function, and interval + //t1.attach(&f1, &Flipper::flip, note2); pc.printf("Hello World!\n"); - pc.printf("%f",note1); + //pc.printf("%f",note1); // spin in a main loop. flipper will interrupt it to call flip while(1) { - for(int i = 0; i < 10; i++) { - t1.attach(&f1, &Flipper::flip, note2); - led1 = !led1; - wait(0.2); - t1.attach(&f1, &Flipper::flip, note3); - wait(0.2); - } - for(int i = 0; i < 10; i++) { - t1.attach(&f1, &Flipper::flip, note2m); - led1 = !led1; - wait(0.2); - t1.attach(&f1, &Flipper::flip, note3); - wait(0.2); + for(int i = 0; i < length; i++) { + t1.attach(&f1, &Flipper::flip, notes[i]); + wait(durs[i]); } }