ADXL345 Data Saving to STM32F103C8T6's EEPROM by Arduino IDE

Hi everyone. I try to save data from ADXL345 sensor to stm32f103c8t6. But ı can't save it.
I have some errors.

sketch_may09a:25:45: error: invalid conversion from 'uint16_t {aka short unsigned int}' to 'uint16 {aka short unsigned int}' [-fpermissive]
Serial.print (EEPROM.read(addresses, xdata));
^
In file included from C:\Users\ufukc\AppData\Local\Temp\arduino_modified_sketch_883987\sketch_may09a.ino:3:0:
C:\Users\ufukc\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2021.5.31\libraries\EEPROM/EEPROM.h:69:9: error: initializing argument 2 of 'uint16 EEPROMClass::read(uint16, uint16*)' [-fpermissive]
uint16 read (uint16 address, uint16 data);
^
exit status 1
invalid conversion from 'uint16_t {aka short unsigned int}' to 'uint16
{aka short unsigned int*}' [-fpermissive]
**
Here they are. What should ı do for solving my problem?
My codes:
#include <Wire.h>
#include <ADXL345.h>
#include <EEPROM.h>

ADXL345 adxl;
int x,y,z;
long int a = 0;
int b = 0;
int sayi = 0;
int xe;

uint16_t addresses = 0;
uint16_t xdata;

void setup()
{
adxl.powerOn();
Serial.begin(9600);
Serial.println(" -----------------------------------------");
Serial.println("| X verisi EPROM'a kaydediliyor | Kaydedildi |");
EEPROM.write(addresses, xdata);
delay(100);
Serial.println("EPROM'dan veri okunuyor.....");
Serial.print (EEPROM.read(addresses, xdata));

addresses++;

}

void loop()
{
adxl.readXYZ(&x, &y, &z);
a = x +a;

sayi = sayi + 1;

if (sayi >=100){
xe = a/100;
xdata = (xe*10)/10;
sayi =0;
a = 0;

}
}
Thanks.

It is telling you the second argument to EEPROM.read() needs to be a pointer, not a value. It also looks like you should declare your variable as unit16 instead of uint16_t

Which pointer should ı use? What can ı write there? I want to see random sensor value in serial monitor.
And you wrote unit16, will it be uint16?

Like that?

Thanks, it worked but now ı can't see adxl345's data in serial monitor. Serial monitor is clear. What can ı do?

You don't even see that?

I see that, but ı can't see adxl345's data in serial monitor.

Can you show your code, please?

(In code tags this time)

#include <Wire.h>
#include <ADXL345.h>
#include <EEPROM.h>

ADXL345 adxl;
int x,y,z;
long int a = 0;
int b = 0;
int sayi = 0;
int xe;

uint16_t addresses = 0;
uint16_t xdata;

void setup()
{
adxl.powerOn();
Serial.begin(9600);
Serial.println(" -----------------------------------------");
Serial.println("| X verisi EPROM'a kaydediliyor | Kaydedildi |");
EEPROM.write(addresses, &xdata);
delay(100);
Serial.println("EPROM'dan veri okunuyor.....");
Serial.print (EEPROM.read(addresses, xdata));

addresses++;

}

void loop()
{
adxl.readXYZ(&x, &y, &z);
a = x +a;

sayi = sayi + 1;

if (sayi >=100){
xe = a/100;
xdata = (xe*10)/10;
sayi =0;
a = 0;

}
}

How do you expect to see the adxl345's data on the serial monitor using that code?

(Please add the code tags by editing your last post using the pencil icon)

İs it okey?
Why you say that ? Can't i see?

In your loop() function, you read the data but you never print it. How do you expect it to show up on the serial monitor? If you want to see it, you need to Serial.print(.....) the data you desire.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.