Hello developers. This tutorial is for all the newbies who desire to convert their ideas into reality but do not know where to start. The setup process for Surilli is easy and it only takes a few minutes before you can upload your first program onto the Surilli. This easy setup guide will quickly get your hands on to the actual development process.
STEP 1: Plug in your Surilli to the PC.Note: If you have already gone through the “Getting Started Guide", skip to next step. Else, go through our getting started guide and then return to step 2. This is highly recommended.
STEP 2: Open Arduino IDE & Add “Fade” library To It.First, download the Fade library given at the end of this tutorial and move that folder (after unzipping) to: This PC > Documents > Arduino > Libraries.
Now open Arduino IDE and select Fade from: Sketch > Include libraries > Fade, as shown in the picture below:
You will see the "Fade.h" library included in your IDE as follows:
Copy and paste the code (Given at the and of this tutorial) into your new sketch, and save it on to your computer.
The function for PWM is all defined inside the library. All we need to do is create an object of the class and pass necessary parameters to it. For example:
Fade fade (OutputPin, Starting bright, Brightness level increment/decrement);  
- OutputPin: Which pin your LED is connected to on Surilli.
 - Starting bright: Brightness of light when it starts to fade in or fade out.
 - Brightness level increment/decrement: How fast the LED should fade in or fade out.
 
And finally, we execute our function according to the values being defined.
fade.exec();
Your final sketch should look like this.
Check that you have selected the right board, processor and port number against your Surilli as follows.
- Board = "Surilli"
 - Processor = "ATmega32U4 (3.3V, 8MHz)"
 - Port = Port number changes on every PC. Select whatever is coming in "Port" tab.
 
Finally, Upload the sketch on your Surilli. As shown in the figure below (Red Circle-ed button).
Wait for the the program to be uploaded. It usually takes around 10-15 seconds. After that you will see your Surilli’s default LED pin (Adjacent to the battery connector) fading in/out as shown in the GIF below.
Complete Code:
#include <Fade.h>    
void setup() {  
// put your setup code here, to run once:  
}  
Fade fade(13,0,5); //Fade fade(OutputPin, Starting bright, Brightness level increment/decrement); 
void loop() {  
// put your main code here, to run repeatedly:  
fade.exec();}  
That’s all. Simple but a good one to start off. If you have any queries, you can always visit our website surilli.io or contact our support. Thank you. Keep visiting for more.












Comments