Open pauloboniatti opened 5 months ago
Sorry for the inconvenience. This error originates from a mistake in declaring the variable. In 'TPL.ino', the declaration "TPL0501 tpl = nullptr;" should be "TPL0501* tpl = nullptr;". Thanks for your interest. I've updated the source code and you may try it again.
Please check whether the error still exists. Your comment matters.
Thanks, but still report this error:
D:\X9C10X_test.ino: In function 'void loop()': D:\potenziometro_SPI_provare.ino:18:9: error: request for member 'setResistor' in 'tpl', which is of pointer type 'TPL0501*' (maybe you meant to use '->' ?) tpl.setResistor(tpl, cnt); ^~~~~~~~~~~ exit status 1 Compilation error: request for member 'setResistor' in 'tpl', which is of pointer type 'TPL0501*' (maybe you meant to use '->' ?)
To access members of a pointer, we should use '->' instead of '.'. I've updated the code and you may try it again.
Besides, this code is tested on Arduino Nano ESP32, whose SPI framework may be a little different from those based on AVR chips. Since I do not have the hardward by my hand, you may modify the SPI part with reference to examples on the internet (e.g. https://www.circuitbasics.com/how-to-set-up-spi-communication-for-arduino/).
I'll try it later. Thank you very much!
HI. Thank's for your job. This was the only library I found for TPL0501. I'm sorry but I'm a beginner in Arduino (UNO R3). I installed your library and just opened the example file, but I'm getting all these errors. What did I do wrong? Thank you.
D:\TPL0501_TEST.ino:3:15: error: conversion from 'std::nullptr_t' to non-scalar type 'TPL0501' requested TPL0501 tpl = nullptr; ^~~~~~~ D:\TPL0501_TEST.ino: In function 'void setup()': D:\TPL0501_TEST.ino:7:33: error: no match for 'operator=' (operand types are 'TPL0501' and 'TPL0501*') tpl = new TPL0501(A5, A1, A0); ^ In file included from D:\TPL0501_TEST.ino:1:0: d:\Arduino\libraries\TPL0501/TPL0501.h:6:7: note: candidate: TPL0501& TPL0501::operator=(const TPL0501&) class TPL0501 { ^~~~~~~ d:\Arduino\libraries\TPL0501/TPL0501.h:6:7: note: no known conversion for argument 1 from 'TPL0501*' to 'const TPL0501&' d:\Arduino\libraries\TPL0501/TPL0501.h:6:7: note: candidate: TPL0501& TPL0501::operator=(TPL0501&&) d:\Arduino\libraries\TPL0501/TPL0501.h:6:7: note: no known conversion for argument 1 from 'TPL0501*' to 'TPL0501&&' D:\TPL0501_TEST.ino: In function 'void loop()': D:\TPL0501_TEST.ino:18:29: error: no matching function for call to 'TPL0501::setResistor(TPL0501&, uint8_t&)' tpl.setResistor(tpl, cnt); ^ In file included from D:\TPL0501_TEST.ino:1:0: d:\Arduino\libraries\TPL0501/TPL0501.h:12:10: note: candidate: void TPL0501::setResistor(uint8_t) void setResistor(uint8_t value); ^~~~~~~~~~~ d:\Arduino\libraries\TPL0501/TPL0501.h:12:10: note: candidate expects 1 argument, 2 provided exit status 1 Compilation error: conversion from 'std::nullptr_t' to non-scalar type 'TPL0501' requested