Hi!
I'll try to answer everyone.
First, I can't upload my code because of confidentiality issues but here is a simple version of what I do :
void setup() {
...
}
void loop(){
while(buffer.size >0){
Serial.write(values);// each value is 8 bytes long, takes 160µs min
}
update_sensors_values();// I measured 100µs
}
void interrupt1(){ // I measured 40µs
increment();
buffer.add(current_sensors_states);
}
void interrupt2(){ // I measured 20µs
increment();
}
void interrupt3(){ // I measured 20µs
increment();
}
I have 333µs between 2 calls of interrupt1. As you can see, if Serial.write is too long, I won't have enough time to send one value and update the sensors' values, so I'll keep sending old sensors' values. If it happens once, it's not a problem but if it happens 10 times on a row, it's not good.
I agree about the whole "setting a flag" thing but for the moment it's not an issue since it's working (40µs for interrupt1 is pretty secure if there are 333µs between 2 interrupts1).
I understand completely the link you provided me, I don't have a problem with this. However, I still can't imagine how to use two AVRs at the same time. ![]()