I finally got the device and tried your code but I am getting the following error:
Adafruit_GFX/Adafruit_GFX.cpp:36:0: warning: "pgm_read_byte" redefined [enabled by default]
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
In file included from ../wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from Adafruit_GFX/Adafruit_GFX.h:4,
from Adafruit_GFX/Adafruit_GFX.cpp:34:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) (*(x))
^
Adafruit_SSD1306/Adafruit_GFX.cpp:36:0: warning: "pgm_read_byte" redefined [enabled by default]
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
^
In file included from ../wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from Adafruit_SSD1306/Adafruit_GFX.h:4,
from Adafruit_SSD1306/Adafruit_GFX.cpp:34:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) (*(x))
^
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::invertDisplay(bool)':
Adafruit_SSD1306/Adafruit_GFX.cpp:420: multiple definition of `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:420: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:462: multiple definition of `Adafruit_GFX::drawRect(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:462: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:470: multiple definition of `Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:470: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:476: multiple definition of `Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:476: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillRect(short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:482: multiple definition of `Adafruit_GFX::fillRect(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:482: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillScreen(unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:489: multiple definition of `Adafruit_GFX::fillScreen(unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:489: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::invertDisplay(bool)':
Adafruit_SSD1306/Adafruit_GFX.cpp:727: multiple definition of `Adafruit_GFX::invertDisplay(bool)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:727: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::Adafruit_GFX(short, short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:297: multiple definition of `Adafruit_GFX::Adafruit_GFX(short, short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:297: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::Adafruit_GFX(short, short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:297: multiple definition of `Adafruit_GFX::Adafruit_GFX(short, short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:297: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawCircle(short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:311: multiple definition of `Adafruit_GFX::drawCircle(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:311: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawCircleHelper(short, short, short, unsigned char, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:345: multiple definition of `Adafruit_GFX::drawCircleHelper(short, short, short, unsigned char, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:345: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillCircleHelper(short, short, short, unsigned char, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:388: multiple definition of `Adafruit_GFX::fillCircleHelper(short, short, short, unsigned char, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:388: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillCircle(short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:381: multiple definition of `Adafruit_GFX::fillCircle(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:381: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:495: multiple definition of `Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:495: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:510: multiple definition of `Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:510: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:522: multiple definition of `Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:522: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:531: multiple definition of `Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:531: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:608: multiple definition of `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:608: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)':
Adafruit_SSD1306/Adafruit_GFX.cpp:641: multiple definition of `Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:641: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::write(unsigned char)':
Adafruit_SSD1306/Adafruit_GFX.cpp:621: multiple definition of `Adafruit_GFX::write(unsigned char)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:621: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setCursor(short, short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:675: multiple definition of `Adafruit_GFX::setCursor(short, short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:675: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setTextSize(unsigned char)':
Adafruit_SSD1306/Adafruit_GFX.cpp:680: multiple definition of `Adafruit_GFX::setTextSize(unsigned char)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:680: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setTextColor(unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:686: multiple definition of `Adafruit_GFX::setTextColor(unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:686: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setTextColor(unsigned short, unsigned short)':
Adafruit_SSD1306/Adafruit_GFX.cpp:690: multiple definition of `Adafruit_GFX::setTextColor(unsigned short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:690: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setTextWrap(bool)':
Adafruit_SSD1306/Adafruit_GFX.cpp:695: multiple definition of `Adafruit_GFX::setTextWrap(bool)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:695: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::getRotation()':
Adafruit_SSD1306/Adafruit_GFX.cpp:700: multiple definition of `Adafruit_GFX::getRotation()'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:700: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::setRotation(unsigned char)':
Adafruit_SSD1306/Adafruit_GFX.cpp:703: multiple definition of `Adafruit_GFX::setRotation(unsigned char)'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:703: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::width()':
Adafruit_SSD1306/Adafruit_GFX.cpp:721: multiple definition of `Adafruit_GFX::width()'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:721: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function `Adafruit_GFX::height()':
Adafruit_SSD1306/Adafruit_GFX.cpp:725: multiple definition of `Adafruit_GFX::height()'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):Adafruit_GFX/Adafruit_GFX.cpp:725: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):(.rodata._ZTV12Adafruit_GFX+0x0): multiple definition of `vtable for Adafruit_GFX'
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):(.rodata._ZTV12Adafruit_GFX+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [31b971c9c4fa1ca1feb25690ef1465d8a4d9c5a1f27b2aa1669348dc4d08.elf] Error 1