I was running the first code given here yesterday, i am using python 2.7 and raspberry pi model B 512MB RAM, raspbian OS HMC5883L with compass when i execute the code above i get an I/O error at lines 27 and 29 can you please help me fix this? And is something wrong with my PI or Compass are they Ok?


Yes i got it right, i should change
bus = smbus.SMBus(0) to bus = smbus.SMBus(1)
since i am using rev2 512 MB board.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.