Function to calculate a square root of a number using Arduino IDE
Open Source software to program Arduino controllers
10 December, 2018 by
Function to calculate a square root of a number using Arduino IDE
Alejandro Jabalquinto

Introduction

The function to calculate a square root of a number is sqrt().


Requirements

Ethernet or 20 I/Os PLC:

Ethernet PLC >>> 

20 I/Os PLC >>> 

Industrial Shields boards:
Industrial Shields Boards >>>


Function

sqrt(x);

Parameter

x: could be any data type 

Example

Next, it is showed a simple example of how to print a square root of an analog value every second.

long number = 0;

void setup() {
  Serial.begin(9600L);
}

void loop() {
  number = sqrt(analogRead(I0_7));
  Serial.println(number);
  delay(1000);
}


Read our Case Studies  Case Studies >>>

 

Function to calculate a square root of a number using Arduino IDE
Alejandro Jabalquinto
10 December, 2018
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!