I have been having some problems with the segment of code below.
#include "stm32f0xx_tim.h"
#include "stm32f0xx_adc.h"
#include "stm32f0xx_rcc.h"
#include "stm32f0xx_conf.h"
#include "adc.h"
void calcSensor(float voltage1, float voltage2, int X, int Y)
{
float Iload = 0;
float Vsensor = 0;
float Rsensor = 0;
float Vdrop = voltage1 - voltage2;
uint32_t resistance = 0;
Iload = Vdrop/Rload;
Vsensor = Vin - Iload*Rmux - Iload*Rdemux-Vdrop;
resistance = Vsensor/Iload;
Rsensor[1][5] = resistance;
Y++;
if (Y == 22)
{
Y = 0;
X++;
if (X == 44)
{
X = 0;
}
}
}
void initRArray(void)
{
int x;
int y;
for(x = 0; x < 44; x++)
{
for(y = 0; y < 22; y++)
{
Rsensor[x][y] = 0;
}
}
}
The error comes the line:
Rsensor[1][5] = resistance;
The error is the same as the title:
subscripted value is neither array nor pointer
I originally had X and Y for indicies but have switched to 0 and 5 thinking it may have been an issue. That did not fix it. Additionally, I have the intRarray function which sets all values to 0. This array compiles fine, and it is using the same array that is having issues.
Below is the declaration of the array in the header file.
unsigned long int Rsensor[44][22];