<< cmd_analog_out arduino cmd_arduino_a_control >>

arduino >> arduino > cmd_analog_out_volt

cmd_analog_out_volt

Command to sent out analog signal to a connected Arduino board

Parameters

h :

Board pointer, to indicate which board to use to differentiate one board from another

pin_no :

Digital pin with ~ to sent the signal

val :

The value in volt (0-5) to be sent to the digital pins with ~ sign.

Description

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.

Examples

h = open_serial(1,9,115200)
cmd_analog_out_volt(h,9,1.2)
close_serial(h)

See also

Authors


Report an issue
<< cmd_analog_out arduino cmd_arduino_a_control >>