How to overcome on this problem?

Hello,
I'm using Simhub to make a DIY simulator steering wheel for games. The problem is, it is not supporting potentiometers, but I found the arduino code in the program. I thought I copy paste the parts I need and then add the code of the pots to it. While compiling the code, I get an error about a line is not declared. It is really strange, because it is a working code since I got it from the program but I cannot complie it. Is there any way of uplodaing a code with an error? Or how can I solve the problem in the code?

Here is the code, the error is: 'FlowSerialTimedRead' was not declared in this scope

#ifndef __SHRGBLEDSBASE_H__
#define __SHRGBLEDSBASE_H__

#include <Arduino.h>

class SHRGBLedsBase {
protected:
	int _maxLeds;
	int _righttoleft;

	void begin(int maxLeds, int righttoleft) {
		_maxLeds = maxLeds;
		_righttoleft = righttoleft;
	}

	virtual void setPixelColor(uint8_t lednumber, uint8_t r, uint8_t g, uint8_t b);

public:

	virtual void show();

	void clear() {
		for (int j = 0; j < _maxLeds; j++) {
			setPixelColor(j, 0, 0, 0);
		}
		show();
	}

	void read() {
		uint8_t r;
		uint8_t g;
		uint8_t b;
		uint16_t b1;
		uint16_t b2;
		uint8_t j;
		int mode = 1;
		mode = FlowSerialTimedRead();
		while (mode > 0)
		{
			// Read all
			if (mode == 1) {
				for (j = 0; j < _maxLeds; j++) {
					r = FlowSerialTimedRead();
					g = FlowSerialTimedRead();
					b = FlowSerialTimedRead();

					if (_righttoleft == 1) {
						setPixelColor(_maxLeds - j - 1, r, g, b);
					}
					else {
						setPixelColor(j, r, g, b);
					}
				}
			}

			// partial led data
			else if (mode == 2) {
				int startled = FlowSerialTimedRead();
				int numleds = FlowSerialTimedRead();

				for (j = startled; j < startled + numleds; j++) {
					/*	if (ENABLE_BLUETOOTH == 0) {*/
					r = FlowSerialTimedRead();
					g = FlowSerialTimedRead();
					b = FlowSerialTimedRead();

					if (_righttoleft == 1) {
						setPixelColor(_maxLeds - j - 1, r, g, b);
					}
					else {
						setPixelColor(j, r, g, b);
					}
				}
			}

			// repeated led data
			else if (mode == 3) {
				int startled = FlowSerialTimedRead();
				int numleds = FlowSerialTimedRead();

				r = FlowSerialTimedRead();
				g = FlowSerialTimedRead();
				b = FlowSerialTimedRead();

				for (j = startled; j < startled + numleds; j++) {
					if (_righttoleft == 1) {
						setPixelColor(_maxLeds - j - 1, r, g, b);
					}
					else {
						setPixelColor(j, r, g, b);
					}
				}
			}

			mode = FlowSerialTimedRead();
		}

		if (_maxLeds > 0) {
			show();
		}
	}
};

#endif

Have you forgotten to include a header file that defines the function?

No, this should be a header file and it doesn't need other than adruino.h

Are you sure?
I've never heard of FlowSerialTimedRead

I copied the exact same code, and it only includes arduino.h, is there something that I'm missing? I don't know much about coding

There is only a "FlowSerialRead.h" but it is not the exact thing, and I added the file to the sketch, nothing happened

Did you add it before #include <SHRGBLeds.h> (or whatever the file you showed us is named)?

No, I did not change anything on the code because it should be a working one as I just copy pasted it.

Could you please all of your code?

But here is the code above. I got problem is this header.

Could you please post all of your code?

Sure, I will when I got home, but I don't see how would that help since the problem is in this file

The problem is that 'FlowSerialTimedRead' was not declared in this scope. We have to figure out where the declaration was supposed to come from. That would be from your sketch or one of the files included, directly or indirectly, by your sketch. Maybe a library. If you don't want to show the other files we can't be of much help finding the missing declaration.

So it can be from another file? Well, as I said, I will show the files but I'm not home at the moment, but I will definitely upload today

The declaration is clearly NOT in the one file you showed so, if it exists at all, it MUST be 'from another file'.

Is this the Git you need?

I got home, and I searched from all the headers that contains this declaration (it was the very similarly named file) and tested what happens if I include it as you recommended it, and it worked! But I got another problem, which is an error says: Error compiling for board Arduino Leonardo. I have no idea what is wrong, the Simhub uploaded to my Leonardo with ease.
I think it is easier just to upload all the original and my copied files.

Simhub_code_test.zip (18,7 kB)
All_code_from_simhub.zip (55,8 kB)

Well, actually yes and no. I needed that file but I got that file but had to include it, it is working now. The only problem is, I got another problem(s) :sweat_smile: Thanks for the file anyway

So, post the error message and the code.

I already posted both codes, in the same comment you highlighted.