Just Only connect only 4pin. GND, 5V(VU), 3.3V, UART(Tx)

Dependencies:   mbed

Committer:
y_notsu
Date:
Tue Nov 19 16:01:17 2013 +0000
Revision:
0:35804e977865
eVY1 Sheld test program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
y_notsu 0:35804e977865 1 #include "mbed.h"
y_notsu 0:35804e977865 2
y_notsu 0:35804e977865 3 Serial evy1(p9, p10); // tx, rx configured for LPC800-MAX
y_notsu 0:35804e977865 4 //Serial evy1(PTA2, PTA1); // tx, rx configured for FRDM-KL25Z
y_notsu 0:35804e977865 5
y_notsu 0:35804e977865 6 // DO NOT EDIT!!
y_notsu 0:35804e977865 7 const char* phoneticSymbols[] = {
y_notsu 0:35804e977865 8 "a", "i", "M", "e", "o", // あいうえお0-4
y_notsu 0:35804e977865 9 "k a", "k' i", "k M", "k e", "k o", // かきくけこ5-9
y_notsu 0:35804e977865 10 "s a", "S i", "s M", "s e", "s o", // さしすえそ10-14
y_notsu 0:35804e977865 11 "t a", "tS i", "ts M", "t e", "t o", // たちつてと15-19
y_notsu 0:35804e977865 12 "n a", "J i", "n M", "n e", "n o", //なにぬねの20-24
y_notsu 0:35804e977865 13 "h a", "C i", "p\\ M", "h e", "h o", // はひふへほ25-29
y_notsu 0:35804e977865 14 "m a", "m' i", "m M", "m e", "m o", // まみむめも30-34
y_notsu 0:35804e977865 15 "j a","i", "j M","e","j o",//やいゆえよ35-39
y_notsu 0:35804e977865 16 "4 a", "4' i", "4 M", "4 e", "4 o", // らりるれろ40-44
y_notsu 0:35804e977865 17 "w a","w o","N\\","","",// わをん 45-49
y_notsu 0:35804e977865 18 "g a", "g' i", "g M", "g e", "g o",//がぎぐげご 50-54
y_notsu 0:35804e977865 19 "dz a", "dZ i", "dz M", "dz e", "dz o",//ざじずぜぞ55-59
y_notsu 0:35804e977865 20 "d a", "dZ i", "dz M", "d e", "d o",//だじづでど60-64
y_notsu 0:35804e977865 21 "b a", "b' i", "b M", "b e", "b o",//ばびぶべぼ 65-69
y_notsu 0:35804e977865 22 "p a", "p' i", "p M", "p e", "p o"//ぱぴぷぺぽ70-74
y_notsu 0:35804e977865 23 };
y_notsu 0:35804e977865 24
y_notsu 0:35804e977865 25 //lylics
y_notsu 0:35804e977865 26 //さんまのうたがきこえてくるよ
y_notsu 0:35804e977865 27 int lylics[]={10,47,30,24,2,15,50,6,9,3,18,7,42,39};
y_notsu 0:35804e977865 28 char mml[] ="CDEFEDC EFGAGFE";
y_notsu 0:35804e977865 29
y_notsu 0:35804e977865 30 void Short_Message(int cmd, int d1, int d2) {
y_notsu 0:35804e977865 31 evy1.putc(cmd);
y_notsu 0:35804e977865 32 evy1.putc(d1);
y_notsu 0:35804e977865 33 evy1.putc(d2);
y_notsu 0:35804e977865 34 }
y_notsu 0:35804e977865 35
y_notsu 0:35804e977865 36 // send lylics
y_notsu 0:35804e977865 37 void lylic_send(int num){
y_notsu 0:35804e977865 38 //hedaer
y_notsu 0:35804e977865 39 evy1.putc(0xF0);
y_notsu 0:35804e977865 40 evy1.putc(0x43);
y_notsu 0:35804e977865 41 evy1.putc(0x79);
y_notsu 0:35804e977865 42 evy1.putc(0x09);
y_notsu 0:35804e977865 43 evy1.putc(0x00);
y_notsu 0:35804e977865 44 evy1.putc(0x50);
y_notsu 0:35804e977865 45 evy1.putc(0x10);
y_notsu 0:35804e977865 46
y_notsu 0:35804e977865 47 for(int i=0;i<num;i++){
y_notsu 0:35804e977865 48 if(i != 0) evy1.putc(0x2c); // 0x2c is separator
y_notsu 0:35804e977865 49 evy1.printf(phoneticSymbols[lylics[i]]);
y_notsu 0:35804e977865 50 }
y_notsu 0:35804e977865 51 //footer
y_notsu 0:35804e977865 52 evy1.putc(0x00); // footer for NSX-1
y_notsu 0:35804e977865 53 evy1.putc(0xF7); // footer of MIDI sys-ex
y_notsu 0:35804e977865 54 }
y_notsu 0:35804e977865 55
y_notsu 0:35804e977865 56
y_notsu 0:35804e977865 57 int main() {
y_notsu 0:35804e977865 58 int key = 0x3c; //C
y_notsu 0:35804e977865 59
y_notsu 0:35804e977865 60 evy1.baud(31250); // MIDI speed
y_notsu 0:35804e977865 61 wait(5); // waiting for eVY1 module boot up
y_notsu 0:35804e977865 62 while(1)
y_notsu 0:35804e977865 63 {
y_notsu 0:35804e977865 64 //send lylics
y_notsu 0:35804e977865 65 int lylic_len = sizeof(lylics) / sizeof(lylics[0]);
y_notsu 0:35804e977865 66 lylic_send(lylic_len); // sending lylics first
y_notsu 0:35804e977865 67
y_notsu 0:35804e977865 68 int mml_len = sizeof(mml) / sizeof(mml[0]);
y_notsu 0:35804e977865 69
y_notsu 0:35804e977865 70 for(int i = 0;i< mml_len ;i++){
y_notsu 0:35804e977865 71 char c = mml[i];
y_notsu 0:35804e977865 72 if(c >= 'a' && c <='z') c-= 0x20;
y_notsu 0:35804e977865 73 if((c>='A' && c<='Z')||c=='<'||c=='>'){
y_notsu 0:35804e977865 74 //key send
y_notsu 0:35804e977865 75 if(i!=0){
y_notsu 0:35804e977865 76 Short_Message(0x90,key,0x7f);
y_notsu 0:35804e977865 77 wait(0.5);
y_notsu 0:35804e977865 78 }
y_notsu 0:35804e977865 79 key= 0x3c;
y_notsu 0:35804e977865 80
y_notsu 0:35804e977865 81 switch(c) {
y_notsu 0:35804e977865 82 case 'C': break;
y_notsu 0:35804e977865 83 case 'D': key+=2; break;
y_notsu 0:35804e977865 84 case 'E': key+=4; break;
y_notsu 0:35804e977865 85 case 'F': key+=5; break;
y_notsu 0:35804e977865 86 case 'G': key+=7; break;
y_notsu 0:35804e977865 87 case 'A': key+=9; break;
y_notsu 0:35804e977865 88 case 'B': key+=11; break;
y_notsu 0:35804e977865 89 default: break;
y_notsu 0:35804e977865 90 }
y_notsu 0:35804e977865 91 }
y_notsu 0:35804e977865 92 }
y_notsu 0:35804e977865 93 Short_Message(0x90,key,0x7f); // note on message. 0x90=1ch, 0x7f=Velocity
y_notsu 0:35804e977865 94 wait(0.5);
y_notsu 0:35804e977865 95 }
y_notsu 0:35804e977865 96 }
y_notsu 0:35804e977865 97