Sincerest gratitude to everyone for helping me out! Though, the biggest problem is that I'm a novice(can blink and fade an LED).
For this reason, though I was able to understand the replies, I'm unable to put this in code.
I'm using Kokoras' RPM Indicator project (Arduino Bluetooth OBDII RPM Shift Light) as a base and modifying it according to my needs.
So, where do I need to incorporate this in my code?
johnwasser:
Sounds like a "circular buffer" to me.struct {int _RPM; int _MPH;} Entries[4];
byte BufferPointer;
void addEntry(int RPM, int MPH) {
Entries[BufferPointer].RPM = _RPM;
Entries[BufferPointer].MPH = _MPH;
BufferPointer = (BufferPointer+1) % 4; // Modulo operator to give a 0..3 answer
}
// Entries[BufferPointer] is the oldest entry
// Entries[(BufferPointer+1) %4] is the second-oldest entry
// Entries[(BufferPointer+2) %4] is the third-oldest entry
// Entries[(BufferPointer+3) %4] is the newest entry
UKHeliBob:
It seems to me that these 2 statements are contradictory
I'm sorry if I messed it up, but I need the last 4 data set received from the OBD for the job.
Regards