-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpianopalgui.m
64 lines (53 loc) · 1.89 KB
/
pianopalgui.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
%choice = menu('Choose your mode: ', 'Scale', 'Arpeggio');
%a = arduino();
% arduino = serial('/dev/cu.usbserial-AH05JZT5', 'BaudRate', 9600);
% fopen(arduino);
% answer = 52;
% fprintf(arduino, '%f', answer);
% fclose(arduino);
% doi = 3 ;
% arduino=serial('/dev/tty.usbserial-AH05JZT5','BaudRate',9600); % create serial communication object
% fopen(arduino); % initiate arduino communication
% pause(2);
% fprintf(arduino, '%s', char(doi)); % send answer variable content to arduino
% fclose(arduino);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% s = serial('/dev/tty.usbmodem450','BaudRate',9600);
%
%
% while(1==1)
% fopen(s);
% choice = menu('Options:', 'Scale', 'Arpeggio', 'Increase Speed', 'Decrease Speed');
% fprintf(s,choice);
% fclose(s);
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
clc
%Creates a serial connection
serialPort=serial('/dev/tty.usbmodem14621','BaudRate',9600);
%Change the Terminator property of the serial port to make it faster
%set(serialPort,'Terminator','CR');
%Informs about errors
%warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
%Opens the serial port
UIControl_FontSize_bak = get(0, 'DefaultUIControlFontSize');
set(0, 'DefaultUIControlFontSize', 65);
set(0, 'DefaultUIControlFontSize', UIControl_FontSize_bak);
speedfactor = 5;
while(1==1)
UIControl_FontSize_bak = get(0, 'DefaultUIControlFontSize');
set(0, 'DefaultUIControlFontSize', 105);
choice = menu('Options: ','Scale', 'Arpeggio', 'Twinkle Twinkle', 'Married Life', 'Chopsticks', 'Ode to Joy', 'Increase Speed', 'Decrease Speed');
if choice == 7
speedfactor = speedfactor-1;
elseif choice == 8
speedfactor = speedfactor+1;
end
choice = speedfactor*10 + choice;
set(0, 'DefaultUIControlFontSize', UIControl_FontSize_bak);
fopen(serialPort);
pause(1);
fprintf(serialPort,'%d',choice);
fclose(serialPort);
end