Reply To: How to Open I2C Bus

Home Forums Forums General discussion How to Open I2C Bus Reply To: How to Open I2C Bus


Hi again. I have a few problems:

1) Unlike the other codes, why do I always have to CD into the library when running these executables:
a) pi@raspberry~$ sudo./gyro_accelerometer_tutorial02
b) pi@raspberry~$ sudo./compass_tutorial03

Only these two tutorials don’t execute without having to CD.. while others work perfectly fine even if i type the executable straight after “pi@raspberrypi~$

2) Calibration Questions

a) Step 3 says “Stop the program with ‘Ctrl-C’ and you will see some definitions printed out in blue text which needs to be added to your compass program. E.g. compass_tutorial03.c in the above Git repository”

–> I was able to get the definitions in blue text (pls see image). What do I do next? By “adding the values to compass program” means I have to replace the values below to the ones I got? Or do i simply just type the values i got under it? Pls help me understand.

`#define magXmax 1210
#define magYmax 1245
#define magZmax 1178
#define magXmin -1335
#define magYmin -1142
#define magZmin -1303

b) Could you pls check if my “rawdatauncalibrated.txt” file has the right contents? (see image)

c) The first two steps of plotting…

Do i type it like this:
pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt
pi@raspberrypi ~ $ awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt

Or like this:
pi@raspberrypi ~ $ sudo ./compass_tutorial01 > rawdatauncalibrated.txt
awk ‘NR>2{ print l} {l=$0}’ calnewtemp.txt > ~/uncalibrated.txt

3) How can I rotate the compass display by 90 degrees … i’m using an led tv so it’s displaying in landscape orientation, how can i make it portrait.

Thanks a lot.

Blip, blop, bloop…