Led brightness control using Range slider

I recently completed the Home Automation topic in which LED control is done by button titled ON/OFF using the command digitalWrite. I was intrigued to control the brightness of LED using a range slider.
I was able to create the range slider using html but i’m not sure how to connect it with the led and i’m confused if i must make use of analogWrite command for this.
Could you please help me out with this?
Thank you…

!! THere is an API Limit of 20 trys in 1 minute. If you exhaust you have to wait 6 hours.

You can make use of javascript/jquery
Let this be your slider
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">

Now to change the LED brightness add onchangeattribute
To avoid exceeding API Limit add step attribute
Since LED would take values from 0 to 255 …let step be 20;

So your slider code would be
<input type="range" min="0" max="255" value="100" class="slider" id="myRange" step="20" onchange="update(this.value)">

Now add a<script> for updation of LED Brigthness.

       function update(value){
              analogWrite(0,value);              // PIN number, value 

Hope that Helps !