summaryrefslogtreecommitdiff
path: root/tools/scilab/linux/help/en_US/cmd_analog_out.xml
blob: 9895f799f03f67c47bb6c9619110d082ec8c9dd4 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>

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

<refentry version="5.0-subset Scilab" xml:id="cmd_analog_out" 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_analog_out</refname>
    <refpurpose>Command to sent out analog signal to a connected Arduino board</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   cmd_analog_out(h,pin_no,val)
   
   </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>pin_no :</term>
      <listitem><para> Digital pin with ~ to sent the signal</para></listitem></varlistentry>
   <varlistentry><term>val :</term>
      <listitem><para> The value of 0-255 to be sent to the digital pins with ~ sign. It will be then scaled to 0-5V</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
The analog outputs of the Arduino Uno is available at the pins 3,5,6,9,10 and 11, while on the Mega board, the outputs are on pins 1-13 and 44-46.
It is a bit misleading to use the term "analog output", because in order to generate this output while minimizing energy losses,
the Arduino uses PWM (Pulse Width Modulation) available on these ports. By varying the duty cycle of the PWM is altered the average
voltage across the component connected to this port, which has the effect of having a analog output voltage.
   </para>
   <para>
The input port accepts the value from 0 to 255 which is correspoding to the duty cycle of 0 to 100%. In other words, sending 0 to the block will generate 0 V output at the port, 127 generates 2.5V and 255 generates 5V. (the port is 8 bits, so the resolutions of output would be 2^8 =256).
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
ok = open_serial(1,9,115200)
cmd_analog_out(1,9,100)
close_serial(1)

   ]]></programlisting>
</refsection>

<refsection>
   <title>See also</title>
   <simplelist type="inline">
   <member><link linkend="cmd_analog_out_volt">cmd_analog_out_volt</link></member>
   <member><link linkend="cmd_arduino_a_control">cmd_arduino_a_control</link></member>
   </simplelist>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Bruno JOFRET, Tan C.L.</member>
   </simplelist>
</refsection>
</refentry>