help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave-Arduino-Servo


From: John Donoghue
Subject: Re: Octave-Arduino-Servo
Date: Sat, 1 Dec 2018 20:10:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 12/1/18 4:11 PM, Vicent Borras wrote:
Hi John,
I've done as you've said.
When I run the first time there is no error message and the servo works well.
Then I typed "clear all" and worked well again but showing two warnigs.
After that I tried to run the program without "clear all" and the servo didn't work and I didn't got error or warnings messages.
Finally I typed "clear all" and worked well showing the warnings.
I'm sending all the output.
Thanks again

a=10
ar = arduino();

b=20
myServo = servo(ar, "d9", "minpulseduration", 1.0e-3,  "maxpulseduration", 2.0e-3)
c=30
writePosition (myServo, .5);
d=40
position = readPosition (myServo)

speed = 0.02;

for count = (1:150)

   pos = readPosition (myServo);

  pos = pos + speed;

   if(pos > 1)

      pos = 1;

      speed = -speed;

    endif

    if(pos < 0)

      pos = 0;

      speed = -speed;

    endif

   writePosition (myServo, pos);

   pause(0.1);

endfor
___________________________________________________
GNU Octave, version 4.2.2
Copyright (C) 2018 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

>> pkg load arduino
>> provaArduino3    HERE WORKED WELL

a =  10
b =  20
myServo =
  arduino servo object with fields of:

                pins = d9
    minpulseduration = 0.001000
    maxpulseduration = 0.002000
c =  30
d =  40
position =  0.50000
>> clear all
>> provaArduino3     HERE WORKED WELL
a =  10
warning: duplicate binary operator '==' for types 'octave_serial' and 'octave_serial'
warning: duplicate binary operator '!=' for types 'octave_serial' and 'octave_serial'
b =  20
myServo =
  arduino servo object with fields of:

                pins = d9
    minpulseduration = 0.001000
    maxpulseduration = 0.002000
c =  30
d =  40
position =  0.50000
>> provaArduino3    HERE DIDN'T WORK
a =  10
b =  20
myServo =
  arduino servo object with fields of:

                pins = d9
    minpulseduration = 0.001000
    maxpulseduration = 0.002000
c =  30
d =  40
position =  0.50000
>> clear all
>> provaArduino3   HERE WORKED AGAIN
a =  10
warning: duplicate binary operator '==' for types 'octave_serial' and 'octave_serial'
warning: duplicate binary operator '!=' for types 'octave_serial' and 'octave_serial'
b =  20
myServo =
  arduino servo object with fields of:

                pins = d9
    minpulseduration = 0.001000
    maxpulseduration = 0.002000
c =  30
d =  40
position =  0.50000
>>

Missatge de John Donoghue <address@hidden> del dia ds., 1 de des. 2018 a les 21:08:
On 12/1/18 11:36 AM, Vicent Borras wrote:
> so your previos program with steps on movement of 0.02 and I've got
> the same result, the error message and the need of disconnect it to
> run it again. Maybe the err


Just to be clear.
Starting with the arduino plugged in, NOT running octave.

Run octave and then execute the the step program once only.


 > provaArduino3


Does it show the error, does it move the servo. Can you provide full
output ?


Without disconnecting the arduino, run


 > clear all


Then rerun the step program

 > provaArduino3


What does it do ? Can provide full output.




ok - no errors printed when it didnt work ?

After running the script, are the servo and arduino objects in the variable window?

If so, thats the main issue - as the hardware is already allocated from the original calls, but doesnt check whethers ats already allocated on the second call.


the clear all clears all the variables and so frees the objects, so then allows them to be recreated correctly gain.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]