Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Yash Sanghvi has Published 192 Articles
Yash Sanghvi
406 Views
Converting analog values to digital is a common requirement from microcontrollers in general, and Arduino is no different. Arduino IDE has a built-in analogRead function to facilitate the conversion of analog values to digital.From the programming perspective, the only thing you require to know is the pins of your microcontroller ... Read More
Yash Sanghvi
1K+ Views
In order to access any pin of your board in Arduino, you can simply reference the number of the pin as an integer. On the Arduino boards like Uno, the label is provided for all the I/O pins, and the same label can be used in the code.Thus, both the ... Read More
Yash Sanghvi
2K+ Views
The general way of using third-party libraries in Arduino is to install them from Tools -> Manage Libraries. We already have a separate post to cover that. However, what if a library you are using for cannot be found in Tools -> Manage Libraries? After all, Manage Libraries only includes ... Read More
Yash Sanghvi
10K+ Views
In every language, generally, the first Hello World project is a simple program that prints "Hello World"! We will see what such a code would look like for Arduino. The below code will print "Hello World" on the screen every time your board is powered ON.Examplevoid setup() { Serial.begin(9600); ... Read More
Yash Sanghvi
8K+ Views
The for and while loops in Arduino follow the C language syntax.The syntax for the for loop is −Syntaxfor(iterator initialization; stop condition; increment instruction){ //Do something }Examplefor(int i = 0; i< 50; i++){ //Do something }Similarly, the syntax for the while loop is −Syntaxwhile(condition){ //Do something }Exampleint ... Read More
Yash Sanghvi
543 Views
If you are familiar with the C language and would like to use the formatting options provided by C language in the Arduino print statements, then there's an easy way to do it. All you need to do is define a character array, and populate it using sprintf(). Within sprintf, ... Read More
Yash Sanghvi
2K+ Views
Suppose you have a code like the one below −Examplevoid setup() { Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Serial.println(analogRead(A0)); }As you can see, it is continuously printing the results of ADC conversion on A0 pin. Such programs can fill ... Read More
Yash Sanghvi
7K+ Views
In order to print a newline, you can either introduce the '' character in your text, or use Serial.println() instead of Serial.print()An example code is given below −Examplevoid setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println(); Serial.print("This is line1This is line2"); ... Read More
Yash Sanghvi
1K+ Views
Often some functions can output really long floating-point numbers, with several decimal digits. Several times, we are just interested in the first couple of decimal digits, and the remaining digits just reduce the readability and make the Serial Monitor window cluttered.In order to round of floating-point numbers when printing to ... Read More
Yash Sanghvi
12K+ Views
In order to print binary representation of numbers/ characters in Arduino, you can add 'BIN' as the second argument of your Serial.print() function. Example is shown below −Examplevoid setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println(); Serial.println(75); Serial.println(75, BIN); ... Read More