Connecting and testing the Grove (Seedstudio) 3-Axis Digital Compass

Looks like I have it connected correctly to the I2C port (left side , bottom connector).

Perhaps compass_bot.py is too complex a program just to test the compass with.

Trying to run the compass_bot.py and getting these errors:

pi@raspberrypi:~/gopigo/Software/Python/Examples/Compass_Robot $ python compass_bot.py
Traceback (most recent call last):
File “compass_bot.py”, line 53, in
turtle.Turtle()
File “/usr/lib/python2.7/lib-tk/turtle.py”, line 3703, in init
Turtle._screen = Screen()
File “/usr/lib/python2.7/lib-tk/turtle.py”, line 3552, in Screen
Turtle._screen = _Screen()
File “/usr/lib/python2.7/lib-tk/turtle.py”, line 3568, in init
_Screen._root = self._root = _Root()
File “/usr/lib/python2.7/lib-tk/turtle.py”, line 458, in init
TK.Tk.init(self)
File “/usr/lib/python2.7/lib-tk/Tkinter.py”, line 1813, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

In the readme.md, there are usually no mentions of setup, dependencies or test conditions.
The compass represents only a small part of the overall project so having to hack how-to’s on this will just slow me down.

Can you provide some directions on how to test the compass please?

Thanks

I’m on a cell phone right now and I can’t really test things. My apologies for that. Are you by any chance connected to your Pi via ssh and not VNC?
Turtle needs a graphic display.

Cleo

How did you guess?

Yes, I will try vnc instead.

Thanks!

1 Like

Hmm, cause I’m a mom and I have developed a sixth sense? :slight_smile:

More seriously, this line gave it away:

_tkinter.TclError: no display name and no $DISPLAY environment variable

1 Like