Yash Sanghvi

Yash Sanghvi

192 Articles Published

Articles by Yash Sanghvi

Page 7 of 20

What are the major new features in Arduino IDE 2.0?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 448 Views

The major new features in Arduino IDE 2.0 as compared to the previous versions are −Addition of Autocomplete featureThis was one of the main features putting Arduino at a disadvantage. Several other IDEs came with the autocomplete feature, which made writing code much faster. With the introduction of this feature, Arduino IDE will hopefully cover some lost groundAddition of Debugging ToolThough not yet supported by every board and platform, the introduction of this tool is a step in the right direction. It helps you introduce breakpoints and watch variables at runtime, helping the process of debugging.Serial Monitor is no longer ...

Read More

How to download and install Arduino IDE 2.0?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 376 Views

Arduino IDE 2.0 is currently available in the beta version. It can be downloaded from the following link: https://www.arduino.cc/en/softwareOnce the .exe file is downloaded, follow the installation steps. Accept the License Agreement, select access, and then select the installation location and click Install.Once the installation is done, open the IDE.Open the dropdown at the top and click 'Select Other Board and Port'Next, select your board and port in the popup that opens up. If you select Arduino boards for the first time, you may see this message −Click Yes, and your IDE 2.0 is ready to work with your Arduino ...

Read More

Difference between #define and const in Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 5K+ Views

If you've done sufficient Arduino programming, you'd have seen that there are two ways of defining constants.#defineOne way is to use #define, like#define const_name 3constThe other way is to use the const keyword, likeconst int var_name = 3; Difference between #define and const#define is like a placeholder. The Arduino compiler replaces all mentions of this constant with its value at the compile time. This means that the values defined using #define don't take up any program space.Variables defined using const, on the other hand, are just normal variables, whose values can't be changed. They take up program memory space, and ...

Read More

How to Use Volatile Variables in Arduino?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 3K+ Views

Just like in C and C++, you need to qualify a variable with the volatile keyword if it can be modified within an interrupt routine.When you qualify a variable as volatile, this is what happens behind the scenes −The compiler gets instructed that the variable should be loaded into the RAM and not the storage register (where program variables are generally stored/manipulated)This ensures that any changes to the variable outside of the loop() (for example in the interrupt service routine), get immediately reflected in the loop()If you have a variable larger than a byte in size (int or long), then ...

Read More

How to Use Static Variables in Arduino?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 4K+ Views

A static variable is a special kind of variable; it is allocated memory 'statically'. Its lifetime is the entire run of the program. It is specific to a function, i.e., only the function that defined it can access it. However, it doesn't get destroyed after the function call ends. It preserves its value between successive function calls. It is created and initialized the first time a function is called. In the next function call, it is not created again. It just exists.ExampleTake a look at the following example.void setup() {    Serial.begin(9600);    Serial.println(); } void loop() {    staticFunctionDemo(); ...

Read More

How to Use 'U' and 'L' formatters in Arduino?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 884 Views

When going through Arduino codes, you may come across some numbers which are followed by either a U or an L or both (or in small caps, u and l). These are formatters, which force integer constants to be of a specific format. U forces an integer constant to be of the unsigned data format, while L forces the integer constant to be of the long data format.These formatters can be used when defining variables, as well as using some integer values directly in a formula.Exampleint a = 33u; # define b 33ul int c = a*1000L;All of the above ...

Read More

String comparisons in Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 557 Views

The same operators that are used for comparing integers like , >=, 'A'.ExampleTake a look at the following example.void setup() {    Serial.begin(9600);    Serial.println();    String s1 = "Hello";    String s2 = "hello";    String s3 = "100";    String s4 = "90";    if (s1 > s2) {       Serial.println("s1 is greater than s2");    } else if(s2 > s1) {       Serial.println("s2 is greater than s1");    }    if (s3 > s4) {       Serial.println("s3 is greater than s4");    } else if(s4 > s3) {     ...

Read More

String to byteArray in Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 9K+ Views

The getBytes() function helps copy the content of a String to a byte array. The syntax is −string1.getBytes(buf, len)where, string1 is the string whose content you want to copy to a byte array, buf is the byte array, andlen is the length of content to be copied.ExampleThe following example illustrates how to use this function −byte buf[10]; void setup() {    Serial.begin(9600);    Serial.println();    String s1 = "Hello World";    s1.getBytes(buf, 5);    for (int i = 0; i < 10; i++) {       Serial.println(buf[i]);    } } void loop() { }OutputThe Serial Monitor output is shown ...

Read More

How to Use isControl() in Arduino?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 737 Views

The isControl() function is used to determine if a character is a control character. A control character or a non-printing character (NPC) is a code point (a number) in a character set that does not represent a written symbol. All entries in the ASCII table below code 32 are of this kind. This includes characters like '', '\t', and so on.SyntaxThe syntax of the isControl function is as follows −isControl(myChar)Where myChar is the character being evaluated. If it is a control character, this function returns True, otherwise False.ExampleThe following example illustrates how to use this function −void setup() {   ...

Read More

How to interface Arduino with a GSM Module and ping to a website?

Yash Sanghvi
Yash Sanghvi
Updated on 24-Jul-2021 2K+ Views

In this article, we will see how to interface Arduino with a GSM Module, and ping to a website.You will need the following −An Arduino boardA GSM Module (SIM800C, SIM900A, are popular examples, but you can have any other module as well)A GSM (2G) SIM Card, or a 4G SIM Card with 2G fallback option (Jio SIM Cards won't work for this project)A GSM AntennaYou could also get a GSM Module development board, like the one below (the SIM Card Holder is on the other side of the board) −A GSM Module interacts with a microcontroller via UART (see the ...

Read More
Showing 61–70 of 192 articles
« Prev 1 5 6 7 8 9 20 Next »
Advertisements