HI
I am trying to do a (probably) simple project, well I thought.
All I want to do is send a variable value from a poti ( on A0) to the ST25DV NFC message.
however I cant get the analogread value transformed to anything the message will accept..
The ST25DV is connected to a Adafruit QT PY Stemma. with the stemma QT cable.
I tried to modifiy the simple example: but fails..
whats wrong?
thanks
#include "ST25DVSensor.h"
#define SerialPort Serial
#if defined(ARDUINO_B_L4S5I_IOT01A)
// Pin definitions for board B-L4S5I_IOT01A
#define GPO_PIN PE4
#define LPD_PIN PE2
#define SDA_PIN PB11
#define SCL_PIN PB10
#define WireNFC MyWire
TwoWire MyWire(SDA_PIN, SCL_PIN);
ST25DV st25dv(12, -1, &MyWire);
#else
#define DEV_I2C Wire
ST25DV st25dv(12, -1, &DEV_I2C);
#endif
void setup() {
const char uri_write_message[] = "st.com/st25"; // Uri message to write in the tag
const char uri_write_protocol[] = URI_ID_0x01_STRING; // Uri protocol to write in the tag
String uri_write = String(uri_write_protocol) + String(uri_write_message);
// Initialize serial for output.
SerialPort.begin(9600);
// The wire instance used can be omitted in case you use default Wire instance
if(st25dv.begin() == 0) {
SerialPort.println("System Init done!");
} else {
SerialPort.println("System Init failed!");
while(1);
}
if(st25dv.writeURI(uri_write_protocol, uri_write_message, "")) {
SerialPort.println("Write failed!");
while(1);
}
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
char cstr[10];
itoa(sensorValue, cstr, 10);
char uri_write_message[] = {cstr}; // Uri message to write in the tag
const char uri_write_protocol[] = URI_ID_0x01_STRING; // Uri protocol to write in the tag
String uri_write = String(uri_write_protocol) + String(uri_write_message);
if(st25dv.writeURI(uri_write_protocol, uri_write_message, "")) {
SerialPort.println("Write failed!");
while(1);
}
delay(1000);
}
here the errors :
auge.ino: In function 'void loop()':
auge.ino:53:31: error: invalid conversion from 'char*' to 'char' [-fpermissive]
53 | char uri_write_message[] = {cstr}; // Uri message to write in the tag
| ^~~~
| |
| char*
exit status 1
Compilation error: invalid conversion from 'char*' to 'char' [-fpermissive]