In compliance with high industry standards

Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

How to calculate the value raised to a power with Arduino IDE

Introduction

In this post it will be seen how to calculate the value raised to a power. Basically this function takes a number(base) and it raises to another number(exponent). 

The function for calcultaing the value raised to a power using Arduino IDE is pow().  This function is used to raise a number to a certain exponent.

 

Function

pow(base, exponent)


Parameters

base: the number (float)

exponent: the power to which the base is raised (float)


Example

float i=0;
long result;

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

void(loop){
  Serial.println("Base 2: "); 
  for(i=0;i<50;i++){
    result=pow(2,i);
    Serial.println(result);
}

Looking for your ideal PLC?

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

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


Industrial PLC controller comparison >>

Do you want more information?

Just fill the form!

Tell me more!