Hello,
I am trying to use the library msTimer but I think there is a bug when usinf the "Wire.endTransmission" function of the wire.h library.
Wire.endTransmission freezes my application when it is used in an interrupt function.
I am using an Arduino Duemilanove / ATmega328
Best regards,
Florent
---------- here is my debug pg -----------
#include <Wire.h>
#include <MsTimer2.h>
int ID_pcf=0;
int Id_an=0;
int Id_in=0;
int tmps=0;
int mesure[8]; // tab des dernieres mesures
int id_an=0; // num entrée ana à lire
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("Start Calibration");
MsTimer2::set(400, myinterupt); // 500ms period
MsTimer2::start();
}
void loop() {
Serial.print(ID_pcf);
Serial.print("\t id an= ");
Serial.print(id_an);
Serial.print(" \tmesure= ");
Serial.println(tmps);
}
void myinterupt(){
MsTimer2::stop() ;
if (id_an<4) ID_pcf= B1001001;
else ID_pcf=B1001011;
int Id_in=id_an%4;
Wire.beginTransmission(ID_pcf);
Wire.send(Id_in);
// Wire.endTransmission();
//Wire.requestFrom(ID_pcf, 8);
//tmps++=Wire.receive();
// mesure[id_an]=tmps;
if (id_an==7) { id_an= 0;tmps++;}
else {id_an ++;tmps++;}
MsTimer2::start();
}