Professional Documents
Culture Documents
المحاضرة الرابعة
المحاضرة الرابعة
Parameters:
pin: the number of the analog input pin to read from (0 to 5)
Val: variable to save the return of the function (int)
Training & Development Department
training@uruktech.com
Pulse Width Modulation is basically, a square wave with a varying high and
low time. A basic PWM signal is shown in the following figure.
Parameters:
pin: the pin to write to
value: the duty cycle: between 0 (always off) and 255 (always on).
Training & Development Department
training@uruktech.com
Re-maps a number from one range to another.
Syntax:
Parameters:
X = new remappped value
Value: the number or variable to map.
fromLow: the lower bound of the value's current range
fromHigh: the upper bound of the value's current range
toLow: the lower bound of the value's target range
toHigh: the upper bound of the value's target range
• Potentiometer connected to A0
• LED1 connected to PIN 5
• LED2 connected to PIN 6
• When the potentiometer is changed, blinking rate of the two LED is
changed (1 to 3 seconds)