add midi example and i2c test
This commit is contained in:
		
							
								
								
									
										23
									
								
								libs/calliope-midi/midi.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								libs/calliope-midi/midi.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
serial.redirect(
 | 
			
		||||
    SerialPin.P0,
 | 
			
		||||
    SerialPin.P1,
 | 
			
		||||
    31250
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
basic.forever(() => {
 | 
			
		||||
    for (let note = 0; note <= 90 - 1; note++) {
 | 
			
		||||
        // Note on channel 1 (0x90), some note value (note),
 | 
			
		||||
        // middle velocity (0x45):
 | 
			
		||||
        serial.writeString(String.fromCharCode(144));
 | 
			
		||||
        serial.writeString(String.fromCharCode(note));
 | 
			
		||||
        serial.writeString(String.fromCharCode(69));
 | 
			
		||||
        basic.pause(100);
 | 
			
		||||
        // Note on channel 1 (0x90), some note value (note),
 | 
			
		||||
        // silent velocity (0x00):
 | 
			
		||||
        serial.writeString(String.fromCharCode(144));
 | 
			
		||||
        serial.writeString(String.fromCharCode(note));
 | 
			
		||||
        serial.writeString("\0");
 | 
			
		||||
        basic.pause(100);
 | 
			
		||||
        basic.pause(1000);
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										11
									
								
								libs/calliope-midi/pxt.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								libs/calliope-midi/pxt.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "midi",
 | 
			
		||||
    "description": "MIDI Example via Serial",
 | 
			
		||||
    "files": [
 | 
			
		||||
        "midi.ts"
 | 
			
		||||
    ],
 | 
			
		||||
    "public": true,
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
        "core": "file:../core"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user