The question: How long does it take an Arduino, without modifications to it or the IDE's presets, to redefine a variable?
Other Question: How long does it take an Arduino to compare two values, one from an array, the other being 0. Specifically, seeing if they are the same value.
Alternatively: How can I find out more on how to calculate how long each process takes?
Simply measuring it to a tolerance of 4 microseconds is not ideal, as the error would inevitably stack and eventually make things unusable.
For the folk that might have a better idea and are more than happy to share:
I'm programming the Arduino Uno to be a USB hub, it will forward information back and forth through its digital pins.
I give this explanation because it's dealing with the nitty gritty of USB communications, which is commonly dealt with for us, with resources on it scarce, it's not implausible for someone to know the exact details of Arduino and its operation without knowing how USB works. I'm just trying to save you the time and not trying to insult your intelligence.
If you didn't know, it's not as simple as saying "If this wire is high, then make the output high," I tried, in a naive hope. Problem being that the Arduino doesn't know who's currently talking and when its important to read and when its a good time to listen, when the message is over etc. It's simply not in the mix and when Windows sees this, often resulting in a SE1 (both data lines pulled high), it shuts down the serial bus.
So I need the Arduino to read accurately, and to do this, it needs to know when to read.
I'm working at a 9600 baud rate connection, which gives a fair amount of time, it results in a bit time being around 104.16 microseconds, which gives the processor time for its simple tasks it needs to do.
I want the Arduino to confirm that a line has been pulled high for two bit times.
Here's the code snippet (with explanation)
void startUp() {
startVar = digitalRead(SDm); // Time elapsed = Variable Redefinition time + ~4.9us
startVar += digitalRead(SDp); // Time elapsed = (Variable Redefinition time * 2) + ~9.8us
delayMicroseconds(x) // x being a placeholder for 104.16us - the time elapsed
}