You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is the best place to post this but after trying to troubleshoot a problem on the Arduino forums here, it has been suggested that this may be an IDE based issue...
My class definition tries to use Serial for debugging but serial communication fails for any use within the instantiated object and the board has to be reset.
The class definition is: class Channel { public: Channel(uint8_t channel, uint8_t led_pin, Stream* serial) : channel(channel) { stream = serial; }; ~Channel() {} public: private: Stream* stream; void dbgprint(const char* a); void dbgprintln(const char* a); };
This discussion was converted from issue #1962 on January 27, 2024 19:40.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not sure if this is the best place to post this but after trying to troubleshoot a problem on the Arduino forums here, it has been suggested that this may be an IDE based issue...
My class definition tries to use Serial for debugging but serial communication fails for any use within the instantiated object and the board has to be reset.
The class definition is:
class Channel
{
public:
Channel(uint8_t channel, uint8_t led_pin, Stream* serial) :
channel(channel)
{
stream = serial;
};
~Channel()
{}
public:
private:
Stream* stream;
void dbgprint(const char* a);
void dbgprintln(const char* a);
};
The objects are created before setup():
Channel channel0(0, LED_GPIO_L, &Serial);
Channel channel1(1, LED_GPIO_R, &Serial);
and Serial is initialised in setup():
Serial.begin(115200);
while(!Serial);
The debugging functions attempt to use the object version of serial:
void Channel::dbgprint(const char* a)
{
#ifdef DEBUG
stream->print(a);
#endif
}
void Channel::dbgprintln(const char* a)
{
#ifdef DEBUG
stream->println(a);
#endif
}
but using either of these results in the serial port being lost.
Beta Was this translation helpful? Give feedback.
All reactions