Hi
This line give me an error.
//////////////////////////////////
//int M = sqrt(A*A +B*B);
int M = sqrt(UxString2*UxString2 + UxString*UxString);
/////////////////////////////////
invalid operands of types 'char [4]' and 'char [4]' to binary 'operator*'
#include <LCD5110_Graph.h>
LCD5110 lcd(PA4, PA3, PA2, PA0, PA1);
extern unsigned char SmallFont[];
char UxString [4];
char UxString2 [4];
String str;
String str2;
int UxValue = 0;
int UxValue2 = 0;
int M = 0;
#include <STM32ADC.h>
STM32ADC myADC(ADC1);
uint8 pins[] = {PA6, PA7};
const int maxSamples = 2;
uint16_t dataPoints[maxSamples];
long sum1, sum2;
void setup() {
lcd.InitLCD();
lcd.setFont(SmallFont);
Serial.begin(115200);
myADC.calibrate();
rcc_set_prescaler(RCC_PRESCALER_ADC, RCC_ADCPRE_PCLK_DIV_8);
pinMode(PA6, INPUT_ANALOG);
pinMode(PA7, INPUT_ANALOG);
myADC.setSampleRate(ADC_SMPR_239_5);
myADC.setScanMode();
myADC.setPins(pins, 2);
myADC.setContinuous();
myADC.setDMA(dataPoints, 2, (DMA_MINC_MODE | DMA_CIRC_MODE), NULL);
myADC.startConversion();
}
void loop() {
lcd.clrScr();
lcd.update();
UxValue = sum1 / 10; sum1 = 0;// UxValue = analogRead(PA6);
UxValue2 = sum2 / 10; sum2 = 0;// UxValue2 = analogRead(PA7);
UxValue = map( UxValue, 0, 4095, 0, 94);
UxValue2 = map( UxValue2, 0, 4095, 0, 94);
str = String(UxValue) + "%";
str2 = String(UxValue2) + "%";
str.toCharArray(UxString, 4);
str2.toCharArray(UxString2, 4);
fillBar( UxValue); //displays line
lcd.print(UxString, 2, 0); // displays # in %, position x, y
fillBar2( UxValue2); //displays line
lcd.print(UxString2, 22, 0); // displays # in %, position x, y
//////////////////////////////////
//int M = sqrt(A*A +B*B);
int M = sqrt(UxString2*UxString2 + UxString*UxString);
lcd.print(M, 42, 0);
/////////////////////////////////
lcd.update();
for (int j = 0; j < 10; j++) {
sum1 = sum1 + dataPoints[0];
sum2 = sum2 + dataPoints[1];
delay(1);
}
Serial.print(UxValue);
Serial.print(" ");
Serial.println(UxValue2);
}
void fillBar(int percent)
{
percent = map(percent, 0, 100, 0, 90);
lcd.drawLine(2, 44, percent, 44);//x, y
}
void fillBar2(int percent2)
{
percent2 = map(percent2, 0, 100, 0, 90);
lcd.drawLine(2, 46, percent2, 46); //x, y
}
