Skip to main content
Added non breaking space before units, code formatting and fixed the "Arduino Uno"s
Source Link
Greenonline
  • 3.2k
  • 7
  • 37
  • 49

Integrating an analog signal using ARDUINO UNOArduino Uno SMD

I need to integrate an analog signal using my ARDUINO unoArduino Uno. I am sampling the input signal at 1KHz1 KHz using a delay command in my void loopvoid loop() and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s001 s to get my integration.

Since, I am new to ARDUINO UNOArduino Uno, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin
const int c=A0; //my input pin
int d=0; //my summation variable
int e=0; //my integration variable(integration as a summation)
void setup()
{
  pinMode(a, OUTPUT);
}
void loop()
{
  int b=analogRead(c);
  d=d+b; //my summation
  e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms
  analogWrite(a,e); //writing my integration into my output pin

  //print the results to the serial monitor
  Serial.print("input=");
  Serial.print(b);
  Serial.print("\t output=");
  Serial.println(e);

  delay(1); //wait for 1ms as I want it sampled at that rate
}

Integrating an analog signal using ARDUINO UNO SMD

I need to integrate an analog signal using my ARDUINO uno. I am sampling the input signal at 1KHz using a delay command in my void loop and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s to get my integration.

Since, I am new to ARDUINO UNO, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin
const int c=A0; //my input pin
int d=0; //my summation variable
int e=0; //my integration variable(integration as a summation)
void setup()
{
  pinMode(a, OUTPUT);
}
void loop()
{
  int b=analogRead(c);
  d=d+b; //my summation
  e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms
  analogWrite(a,e); //writing my integration into my output pin

  //print the results to the serial monitor
  Serial.print("input=");
  Serial.print(b);
  Serial.print("\t output=");
  Serial.println(e);

  delay(1); //wait for 1ms as I want it sampled at that rate
}

Integrating an analog signal using Arduino Uno SMD

I need to integrate an analog signal using my Arduino Uno. I am sampling the input signal at 1 KHz using a delay command in my void loop() and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001 s to get my integration.

Since, I am new to Arduino Uno, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin
const int c=A0; //my input pin
int d=0; //my summation variable
int e=0; //my integration variable(integration as a summation)
void setup()
{
  pinMode(a, OUTPUT);
}
void loop()
{
  int b=analogRead(c);
  d=d+b; //my summation
  e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms
  analogWrite(a,e); //writing my integration into my output pin

  //print the results to the serial monitor
  Serial.print("input=");
  Serial.print(b);
  Serial.print("\t output=");
  Serial.println(e);

  delay(1); //wait for 1ms as I want it sampled at that rate
}
deleted 14 characters in body
Source Link
Gerben
  • 11.3k
  • 3
  • 22
  • 34

I need to integrate an analog signal using my ARDUINO uno. I am sampling the input signal at 1KHz using a delay command in my void loop and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s to get my integration. 

Since, I am new to ARDUINO UNO, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin const int c=A0; //my input pin int d=0; //my summation variable int e=0; //my integration variable(integration as a summation) void setup() { pinMode(a, OUTPUT); } void loop() { int b=analogRead(c); d=d+b; //my summation e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms analogWrite(a,e); //writing my integration into my output pin //print the results to the serial monitor Serial.print("input="); Serial.print(b); Serial.print("\t output="); Serial.println(e); delay(1); //wait for 1ms as I want it sampled at that rate }
const int a=13; //my output pin
const int c=A0; //my input pin
int d=0; //my summation variable
int e=0; //my integration variable(integration as a summation)
void setup()
{
  pinMode(a, OUTPUT);
}
void loop()
{
  int b=analogRead(c);
  d=d+b; //my summation
  e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms
  analogWrite(a,e); //writing my integration into my output pin

  //print the results to the serial monitor
  Serial.print("input=");
  Serial.print(b);
  Serial.print("\t output=");
  Serial.println(e);

  delay(1); //wait for 1ms as I want it sampled at that rate
}

I need to integrate an analog signal using my ARDUINO uno. I am sampling the input signal at 1KHz using a delay command in my void loop and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s to get my integration. Since, I am new to ARDUINO UNO, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin const int c=A0; //my input pin int d=0; //my summation variable int e=0; //my integration variable(integration as a summation) void setup() { pinMode(a, OUTPUT); } void loop() { int b=analogRead(c); d=d+b; //my summation e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms analogWrite(a,e); //writing my integration into my output pin //print the results to the serial monitor Serial.print("input="); Serial.print(b); Serial.print("\t output="); Serial.println(e); delay(1); //wait for 1ms as I want it sampled at that rate }

I need to integrate an analog signal using my ARDUINO uno. I am sampling the input signal at 1KHz using a delay command in my void loop and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s to get my integration. 

Since, I am new to ARDUINO UNO, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin
const int c=A0; //my input pin
int d=0; //my summation variable
int e=0; //my integration variable(integration as a summation)
void setup()
{
  pinMode(a, OUTPUT);
}
void loop()
{
  int b=analogRead(c);
  d=d+b; //my summation
  e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms
  analogWrite(a,e); //writing my integration into my output pin

  //print the results to the serial monitor
  Serial.print("input=");
  Serial.print(b);
  Serial.print("\t output=");
  Serial.println(e);

  delay(1); //wait for 1ms as I want it sampled at that rate
}
Source Link
Ghosal_C
  • 131
  • 1
  • 1
  • 3

Integrating an analog signal using ARDUINO UNO SMD

I need to integrate an analog signal using my ARDUINO uno. I am sampling the input signal at 1KHz using a delay command in my void loop and adding up the values at the analog read at that specific time. Then I multiply my added output with 0.001s to get my integration. Since, I am new to ARDUINO UNO, I want some review on the code to check whether I am correct or not. Kindly help, I'll be indebted.

const int a=13; //my output pin const int c=A0; //my input pin int d=0; //my summation variable int e=0; //my integration variable(integration as a summation) void setup() { pinMode(a, OUTPUT); } void loop() { int b=analogRead(c); d=d+b; //my summation e=d*10^-3; //my integration as a summation, by sampling my signal at 1ms analogWrite(a,e); //writing my integration into my output pin //print the results to the serial monitor Serial.print("input="); Serial.print(b); Serial.print("\t output="); Serial.println(e); delay(1); //wait for 1ms as I want it sampled at that rate }