sendCommand

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sendCommand

Aline
I'm using arduino 0.5.0 with HX711 on Octave 4.2.2. But I'm havinfgproblems
with the command "sendCommand":

error: 'sendCommand' undefined near line 52 column 21
error: called from
    read_HX711 at line 52 column 19



%**************************************************************************
classdef aline_HX711 < arduinoio.LibraryBase
    properties(Access = protected)
        Pins %Data and Clock pin
    endproperties
    properties (Access = private, Constant = true)
        READ_HX711 = hex2dec('01');
    endproperties
    properties(Access = protected, Constant = true)
        LibraryName = 'basicHX711/aline_HX711'
        DependentLibraries = {}
        LibraryHeaderFiles = 'basicHX711/aline_HX711.h'
        CppHeaderFile = fullfile(arduinoio.FilePath(mfilename('fullpath')),
'src', 'aline_HX711.h')
        CppClassName = 'aline_HX711'
    endproperties
   
    methods(Hidden, Access = public)
        function obj = aline_HX711(parentObj,inputPins)
            obj.Parent = parentObj;
            obj.Pins = getTerminalsFromPins(obj.Parent,inputPins);
            configurePin(parentObj,inputPins{1},'DigitalInput'); % Data Pin
            configurePin(parentObj,inputPins{2},'DigitalOutput'); % Clock
Pin
        endfunction
    endmethods
   
    methods(Access = public)
        function force = read_HX711(obj)
            cmdID = obj.READ_HX711;
            inputs = obj.Pins;
            value = sendCommand (obj, obj.LibraryName, cmdID, inputs);
            value(3)=bitshift(value(3),16);
            value(2)=bitshift(value(2),8);
            force = bitor(value(3),bitor(value(2),value(1)));
        endfunction
    endmethods
endclassdef

Can someone help me?



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

RE: sendCommand

JohnD
> Message: 1
> Date: Mon, 24 Aug 2020 15:59:06 -0500 (CDT)
> From: Aline <[hidden email]>
> To: [hidden email]
> Subject: sendCommand
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> I'm using arduino 0.5.0 with HX711 on Octave 4.2.2. But I'm havinfgproblems
> with the command "sendCommand":
>
> error: 'sendCommand' undefined near line 52 column 21
> error: called from
>     read_HX711 at line 52 column 19
>
>
>
> %***************************************************************
> ***********
> classdef aline_HX711 < arduinoio.LibraryBase
>     properties(Access = protected)
>         Pins %Data and Clock pin
>     endproperties
>     properties (Access = private, Constant = true)
>         READ_HX711 = hex2dec('01');
>     endproperties
>     properties(Access = protected, Constant = true)
>         LibraryName = 'basicHX711/aline_HX711'
>         DependentLibraries = {}
>         LibraryHeaderFiles = 'basicHX711/aline_HX711.h'
>         CppHeaderFile = fullfile(arduinoio.FilePath(mfilename('fullpath')),
> 'src', 'aline_HX711.h')
>         CppClassName = 'aline_HX711'
>     endproperties
>
>     methods(Hidden, Access = public)
>         function obj = aline_HX711(parentObj,inputPins)
>             obj.Parent = parentObj;
>             obj.Pins = getTerminalsFromPins(obj.Parent,inputPins);
>             configurePin(parentObj,inputPins{1},'DigitalInput'); % Data Pin
>             configurePin(parentObj,inputPins{2},'DigitalOutput'); % Clock
> Pin
>         endfunction
>     endmethods
>
>     methods(Access = public)
>         function force = read_HX711(obj)
>             cmdID = obj.READ_HX711;
>             inputs = obj.Pins;
>             value = sendCommand (obj, obj.LibraryName, cmdID, inputs);
>             value(3)=bitshift(value(3),16);
>             value(2)=bitshift(value(2),8);
>             force = bitor(value(3),bitor(value(2),value(1)));
>         endfunction
>     endmethods
> endclassdef
>
> Can someone help me?
>
>
>

In octave-arduino,

sendCommand expects the Arduino object - ie: obj.Parent:

value = sendCommand (obj.Parent, obj.LibraryName, cmdID, inputs);