summaryrefslogtreecommitdiff
path: root/Origin/tools/scilab/linux/help/en_US/cmd_dcmotor_run.xml
blob: c97faa05eb3360b9fbf2b82b4027ba32c2c26429 (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
<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from cmd_dcmotor_run.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="cmd_dcmotor_run" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>cmd_dcmotor_run</refname>
    <refpurpose>Command to run DC motor after setting up</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   cmd_dcmotor_run(h,motor_no,u1)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>h :</term>
      <listitem><para> Board number, reserved for future use. For this version, any number would do</para></listitem></varlistentry>
   <varlistentry><term>motor_no :</term>
      <listitem><para> ID in which the motor has been connected</para></listitem></varlistentry>
   <varlistentry><term>u1 :</term>
      <listitem><para> Value to sent, range from -255 to 255, for clockwise and anti-clockwise direction</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Arduino board does not deliver enough power, so it is necessary to use a H-bridge circuit/IC to control the motor. There are several types of H-bridge IC that do not all operate on the same principle. For example, the L298 requires the use of a PWM signal with current sense. The L293 uses two PWM to set the speed and direction. Ready-to-use Shields are also available.
   </para>
   <para>
Remember that the PWM is 8-bit (0 to 255). The input of the block could accept any value, but it would saturate at +- 255.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
ok = open_serial(1,9,115200)
cmd_dcmotor_setup(1,3,1,9,10)  // Setup DC motor of type 3 (L293), motor 1, pin 9 and 10
cmd_dcmotor_run(1,1,255)
sleep(1000)
cmd_dcmotor_run(1,1,-255)
sleep(1000)
cmd_dcmotor_release(1,1)
close_serial(1)
   ]]></programlisting>
</refsection>
</refentry>