The Code

The FLORA NeoGeo Watch is very easy to use. It has three modes. To change between modes, press and hold the button for about 2-3 seconds. You can hold down the button and it will change from mode 1 to mode 2 to mode 3 and then back to mode 1. The three modes are:

  1. Watch Mode
  2. Navigation Mode
  3. Compass Mode

Watch Mode works by having showing the "hour hand" as an orange LED, the "minute hand" as a yellow LED, and if both "hands" are on top of each other, the LED will glow purple. When you first turn on your watch, you need to give the GPS a clear view of the sky. Once the GPS locks on, it will automatically update the time for you. Now, if you lose a GPS signal, it will still remember the time (until you disconnect the watch from power).

Navigation Mode works by pointing an LED in the direction you need to go to reach the coordinates you entered in the sketch. When you get close to your destination, the LED will change from yellow to red. You need to have a constant GPS lock for this mode to work.

Compass Mode works by always pointing north with a blue LED.

The code for the FLORA NeoGeo Watch is pretty simple and straight forward. We are using the standard Adafruit GPS Library, a Time Library, the LSM303 Compass Module Library, and the FLORA Pixel Library. You will find links to the libraries at

Follow each library’s README file for more information about installing each library.

Follow the FLORA Pixel tutorial for more information about installing the library. Test out the pixel sample code to be sure your pixels are functioning properly.

Next, we need to test out the GPS module. Enter this code into the Arduino IDE and upload to your FLORA with the GPS module attached:

// test a passthru between USB and hardware serial
void setup() {
 while (!Serial);
void loop() {
 if (Serial.available()) {
 char c =;
 if (Serial1.available()) {
 char c =;

To make sure your GPS has a direct view of the sky, hang your watch out the window (but don’t let it fall out). I used a USB extension cable so I could have the watch out the window but still plugged in to the computer!

Open the Arduino IDE serial monitor. You can access the serial monitor by clicking the magnifying glass icon to the far right of the top toolbar. Make sure the dropdown in the lower right of the serial monitor is set to “9600 baud.” If you see a constant stream of GPS data, your GPS module is correctly installed.

The next step is to test out the compass module. With the LSM303DLHC library ( installed in your Adafruit Arduino IDE, open up the magsensor example, or manually enter the code below and upload to your FLORA.

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303_U.h>
/* Assign a unique ID to this sensor at the same time */
Adafruit_LSM303_Mag_Unified mag = Adafruit_LSM303_Mag_Unified(12345);
void setup(void)
 Serial.println("Magnetometer Test"); Serial.println("");
 /* Enable auto-gain */
 /* Initialise the sensor */
 /* There was a problem detecting the LSM303 ...
 check your connections */
 "Ooops, no LSM303 detected ... Check your wiring!");
void loop(void)
 /* Get a new sensor event */
 sensors_event_t event;
 /* Display the results (magnetic vector values are in micro-Tesla (uT))
 Serial.print("X: "); Serial.print(event.magnetic.x);
 Serial.print(" ");
 Serial.print("Y: "); Serial.print(event.magnetic.y);
 Serial.print(" ");
 Serial.print("Z: "); Serial.print(event.magnetic.z);
 Serial.print(" ");Serial.println("uT");

Again, open the serial monitor and make sure you don’t get the “Ooops, no LSM303 detected … Check your wiring!” warning. You should see the X, Y, and Z values change as you move your NeoGeo watch around.

Now that you have confirmed all of the sensors are working, it is time to modify the main NeoGeo watch sketch. Find this part of the code near the top of the sketch:

//                    WAYPOINT                      |
//Please enter the latitude and longitude of your   |
//desired destination:                              |
  #define GEO_LAT                44.998531
  #define GEO_LON               -93.230322
//Your NeoPixel ring may not line up with ours.     |
//Enter which NeoPixel led is your top LED (0-15).  |
  #define TOP_LED                1
//Your compass module may not line up with ours.    |
//Once you run compass mode, compare to a separate  |
//compass (like one found on your smartphone).      |
//Point your TOP_LED north, then count clockwise    |
//how many LEDs away from TOP_LED the lit LED is    |
  #define LED_OFFSET             0
We like iTouchMap for finding latitudes and longitudes online. Dump in a location, such as your home, so you will always be able to find your way home.

We also know that your NeoPixel Ring and compass sensor won't line up perfectly with our design (even our two prototypes didn't line up exactly). So, we made it easy for you to calibrate your watch. The first thing you want to do is calibrate your NeoPixel Ring. This is as simple as lighting up each pixel using the NeoPixel code and determining which pixel is your top pixel (from 0-15). In the code, it is set to pixel 1.

Next, you need to make sure your watch knows which way north is. This is really easy to do. When your watch is on, hold down the button until you get to mode 3, which is the compass mode. Then, using a compass on your smartphone, or the old fashioned kind, point your TOP_LED north. Count clockwise how many pixels away the lit LED is away from the TOP_LED. So, if you aim your TOP_LED north, and the LED 4 spots over (counting clockwise) is lit up, you would change the 0 in the LED_OFFSET code above and replace it with 4.

That's it, you should be ready to upload the code to your FLORA, and start using your NeoGeo Watch!
Last updated on 2015-05-04 at 04.27.26 PM Published on 2013-09-25 at 01.32.09 PM