very preliminary code, pins clearly havent been chosen yet!

Dependencies:   TextLCD mbed

Committer:
gcme93
Date:
Tue Jul 02 17:50:52 2013 +0000
Revision:
1:0404e9aa397f
Parent:
0:438bb4b2ba51
Very preliminary code, pins clearly not chosen yet!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gcme93 0:438bb4b2ba51 1 #include "mbed.h"
gcme93 0:438bb4b2ba51 2 #include "readknobs.h"
gcme93 0:438bb4b2ba51 3 #include "trigger.h"
gcme93 1:0404e9aa397f 4 #include "TextLCD.h"
gcme93 1:0404e9aa397f 5
gcme93 1:0404e9aa397f 6 TextLCD lcd(PTA1, PTA2, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD20x4); // rs, e, d4-d7
gcme93 0:438bb4b2ba51 7
gcme93 0:438bb4b2ba51 8 //Analog Ins
gcme93 0:438bb4b2ba51 9 AnalogIn tmp(PTC2); //Tempo Potentiometer
gcme93 0:438bb4b2ba51 10 AnalogIn sw(PTC2); //Swing Potentiometer
gcme93 0:438bb4b2ba51 11 AnalogIn fill(PTC2); //Fill Potentiometer
gcme93 0:438bb4b2ba51 12
gcme93 0:438bb4b2ba51 13 //Outputs to Drum Noises
gcme93 0:438bb4b2ba51 14 DigitalOut Kick(PTC6);
gcme93 0:438bb4b2ba51 15 DigitalOut Snare(PTC10);
gcme93 0:438bb4b2ba51 16 DigitalOut HHOpen(PTC11);
gcme93 0:438bb4b2ba51 17 DigitalOut HHClosed(PTC6);
gcme93 0:438bb4b2ba51 18 DigitalOut HiTom(PTC10);
gcme93 0:438bb4b2ba51 19 DigitalOut LoTom(PTC11);
gcme93 0:438bb4b2ba51 20 DigitalOut Clap(PTC10);
gcme93 0:438bb4b2ba51 21 DigitalOut Block(PTC11);
gcme93 0:438bb4b2ba51 22
gcme93 0:438bb4b2ba51 23 //Detectors
gcme93 0:438bb4b2ba51 24 DigitalIn doubletime(PTC2); //Doubles the tempo
gcme93 0:438bb4b2ba51 25 DigitalIn enable(PTC2); //The GO switch
gcme93 0:438bb4b2ba51 26 DigitalIn threetime(PTC2); //Causes only first 6 beats to play
gcme93 0:438bb4b2ba51 27 DigitalIn KICK(PTC6);
gcme93 0:438bb4b2ba51 28 DigitalIn SNARE(PTC10);
gcme93 0:438bb4b2ba51 29 DigitalIn HHOPEN(PTC11);
gcme93 0:438bb4b2ba51 30 DigitalIn HHCLOSED(PTC6);
gcme93 0:438bb4b2ba51 31 DigitalIn HITOM(PTC10);
gcme93 0:438bb4b2ba51 32 DigitalIn LOTOM(PTC11);
gcme93 0:438bb4b2ba51 33 DigitalIn CLAP(PTC10);
gcme93 0:438bb4b2ba51 34 DigitalIn BLOCK(PTC23);
gcme93 0:438bb4b2ba51 35
gcme93 0:438bb4b2ba51 36 //Beats
gcme93 0:438bb4b2ba51 37 DigitalOut Beat1(PTC2);
gcme93 0:438bb4b2ba51 38 DigitalOut Beat2(PTC2);
gcme93 0:438bb4b2ba51 39 DigitalOut Beat3(PTC2);
gcme93 0:438bb4b2ba51 40 DigitalOut Beat4(PTC2);
gcme93 0:438bb4b2ba51 41 DigitalOut Beat5(PTC2);
gcme93 0:438bb4b2ba51 42 DigitalOut Beat6(PTC2);
gcme93 0:438bb4b2ba51 43 DigitalOut Beat7(PTC2);
gcme93 0:438bb4b2ba51 44 DigitalOut Beat8(PTC2);
gcme93 0:438bb4b2ba51 45
gcme93 1:0404e9aa397f 46 //GLOBAL Variables
gcme93 0:438bb4b2ba51 47 int pulse = 4; //Pulse length in ms
gcme93 0:438bb4b2ba51 48 int mintempo = 60; //Minimum (normal time) tempo
gcme93 0:438bb4b2ba51 49 int maxtempo = 130; //Maximum (non doubletime) tempo
gcme93 0:438bb4b2ba51 50 int tempo;
gcme93 0:438bb4b2ba51 51 int swing;
gcme93 0:438bb4b2ba51 52 int beat;
gcme93 0:438bb4b2ba51 53
gcme93 0:438bb4b2ba51 54
gcme93 0:438bb4b2ba51 55 int main()
gcme93 0:438bb4b2ba51 56 {
gcme93 0:438bb4b2ba51 57
gcme93 0:438bb4b2ba51 58 while (1)
gcme93 0:438bb4b2ba51 59 {
gcme93 0:438bb4b2ba51 60 readknobs();
gcme93 1:0404e9aa397f 61 wait_ms(10);
gcme93 0:438bb4b2ba51 62 while (enable==1)
gcme93 0:438bb4b2ba51 63 {
gcme93 0:438bb4b2ba51 64 beat=0;
gcme93 0:438bb4b2ba51 65
gcme93 0:438bb4b2ba51 66
gcme93 0:438bb4b2ba51 67 while (beat++ < 8)
gcme93 0:438bb4b2ba51 68 {
gcme93 0:438bb4b2ba51 69
gcme93 0:438bb4b2ba51 70 readknobs();
gcme93 0:438bb4b2ba51 71 trigger();
gcme93 0:438bb4b2ba51 72
gcme93 0:438bb4b2ba51 73 }
gcme93 0:438bb4b2ba51 74
gcme93 0:438bb4b2ba51 75 }
gcme93 0:438bb4b2ba51 76 }
gcme93 0:438bb4b2ba51 77
gcme93 0:438bb4b2ba51 78 }
gcme93 0:438bb4b2ba51 79