Hi,
I would like to learn if arduino can have fault code list like as car's ecu Check engine.
I use bluetooth module, sensor and leds
You can implement them in your sketch, preferably using an enum.
May you have an example???
@mad_jr, you need to provide a lot more information about what you are trying to create.
For example, what sort of faults do you want to be able to identify.
...R
enum ERRORCODES
{
OK,
ERR_SENSORUNRESPONSIVE,
ERR_OVERCURRENT,
};
void setup()
{
Serial.begin(57600);
Serial.print("OK "); Serial.println(OK);
Serial.print("ERR_SENSORUNRESPONSIVE "); Serial.println(ERR_SENSORUNRESPONSIVE);
Serial.print("ERR_OVERCURRENT "); Serial.println(ERR_OVERCURRENT);
}
void loop()
{
// put your main code here, to run repeatedly:
}
Your code needs to decide which code it will return; e.g. if it detects that a motor draws too much current, it will switch off the motor and send ERR_OVERCURRENT to a connected computer.
@Robin2 i want if for a reason led or sensor disconected, it show me fault
For the led , you would need to read the voltage at the led ( after its resistor) with an analog port - it would be at something like 1.4v if connected and 5v if not.
For the sensor , it depends on the sensor and how it is connected .
The Arduino does not have any inbuilt features to do what you want , you need to design them into the hardware and write the appropriate code to work out that the error exists .
mad_jr:
@Robin2 i want if for a reason led or sensor disconected, it show me fault
How do you want the message to appear if a fault is detected.
For example are you content to see something like '1' for an LED fault and '2' for a sensor fault or do you want a message in english such as "led fault" or "sensor fault"
And then, where should this message appear - will it be on the Arduino Serial Monitor?
(plus what is in Reply #6).
...R
@Robin2 i have a bluetooth project controlled by phone and i want when there is a fault a led turn on on phone panel.
mad_jr:
@Robin2 i have a bluetooth project controlled by phone and i want when there is a fault a led turn on on phone panel.
That sounds as if you want the Arduino to send a bluetooth message to the phone. Please give some examples of the content required in those messages.
Are you using an App on the phone that you have downloaded or are you creating the App yourself?
...R
I use remoteXY. That i want is how to my arduino understand if something (sensor, led) disconected.
mad_jr:
I use remoteXY. That i want is how to my arduino understand if something (sensor, led) disconected.
I remember having a brief look at remoteXY when it was new, but I have forgotten all that. Please post a link to the documentation for the latest version.
Have you followed up the suggestion in Reply #6 about how to get the Arduino to detect failures? That should be your first task. Just get it to print a message to the Serial Monitor. There is no purpose in worrying about remoteXY until you have a working program that can detect the faults.
...R