summaryrefslogtreecommitdiff
path: root/tools/scilab/linux/macros/cmd_arduino_a_control.sci
blob: 9ff1492d56ddfbd39e3a4b23ce999dbb5180cdfa (plain)
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
61
62
63
64
65
66
67
68
69
70
// This GUI file is generated by guibuilder version 3.0
//////////
function cmd_arduino_a_control(h,pin_no)
// GUI to control analog signal to be sent to a connected Arduino board
//
// Calling Sequence
//     cmd_arduino_a_control(h,pin_no)
//
// Parameters
//     h : Board number, reserved for future use. For this version, any number would do
//     pin_no : Digital pin with ~ to sent the signal
//
// Description
//     This GUI provides a convenient way to control the value (0-255) to sent to the given pin number on Arduino. 
//  
// Examples
//    ok = open_serial(1,9,115200) 
//    cmd_arduino_a_control(1,9,100)
//    close_serial(1)
// 
// See also
//    cmd_analog_out_volt
//    cmd_analog_out
//
// Authors
//     Bruno JOFRET, Tan C.L. 
//    

    //    str = string(val);
    //
    handles.h = h;
    handles.pin_no = pin_no;
    f=figure('figure_position',[128,41],'figure_size',[300,300],'auto_resize','on','background',[33],'figure_name','Arduino Digital Control',"visible", "off",...
    "dockable", "off", ...
    "infobar_visible", "off", ...
    "toolbar_visible", "off", ...
    "menubar_visible", "off", ...
    "default_axes", "off");

    handles.pbStop=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.3159509,0.16,0.3619632,0.2],'Relief','default','SliderStep',[0.01,0.1],'String','Stop','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','pbStop','Callback','pbStop_callback()')
    handles.spResult=uicontrol(f,'unit','normalized','BackgroundColor',[-1,-1,-1],'Enable','on','FontAngle','normal','FontName','Tahoma','FontSize',[36],'FontUnits','points','FontWeight','bold','ForegroundColor',[-1,-1,-1],'HorizontalAlignment','center','ListboxTop',[],'Max',[255],'Min',[0],'Position',[0.3190184,0.565,0.3527607,0.19],'Relief','default','SliderStep',[1,10],'String',"0",'Style','spinner','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','spResult','Callback','spResult_callback(handles)')


   f.visible = "on";

    handles = resume(handles);
    //set(txtResult,'string',str);
 
endfunction
//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
function spResult_callback(handles)
//    pbResult = findobj("tag', "pbResult");
    
//        val 
        cmd_analog_out(handles.h,handles.pin_no,handles.spResult.value)
       // disp(handles.spResult.value);

endfunction    //////////

function pbStop_callback()
    //Write your callback for  pbStop  here
    close();
    //    abort;


endfunction