FUNCTION TO calculate a square root of a number

FUNCTION TO calculate a square root of a number

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

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);
}
Comments are closed.