sto provando questo sensore che dovrebbe funzionare come una bussola…
il problema è che va per un po’, qualche secondo, e poi si blocca e per farlo ripartire devo resettare l’arduino…
il circuito l’ho montato così: http://www.robot-electronics.co.uk/htm/arduino_examples.htm#CMPS03 Magnetic Compass
mentre questo è il programma:
#include <Wire.h>
#define address 0x60 //defines address of compass
void setup(){
Wire.begin(); //conects I2C
Serial.begin(9600);
}
void loop(){
byte highByte;
byte lowByte;
Wire.beginTransmission(address); //starts communication with cmps03
Wire.send(2); //Sends the register we wish to read
Wire.endTransmission();
Wire.requestFrom(address, 2); //requests high byte
while(Wire.available() < 2); //while there is a byte to receive
highByte = Wire.receive(); //reads the byte as an integer
lowByte = Wire.receive();
int bearing = ((highByte<<8)+lowByte)/10;
Serial.println(bearing);
delay(100);
}
c’è qualcuno che può aiutarmi? secondo voi quale potrebbe essere il problema??