Error Message Using Arduino with REST API

Using the REST API, the Arduino either stays on the "Listening for connections..." forever or the serial monitor prints four (sometimes eight) unreadable characters (or spaces). The code below has omitted the SSID and its password for security purposes.

  This a simple example of the aREST Library for Arduino (Uno/Mega/Due/Teensy)
  using the CC3000 WiFi chip. See the README file for more details.
  Written in 2014 by Marco Schwartz under a GPL license. 

// Import required libraries
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include <CC3000_MDNS.h>
#include <aREST.h>

// These are the pins for the CC3000 chip if you are using a breakout board
#define ADAFRUIT_CC3000_IRQ   2
#define ADAFRUIT_CC3000_VBAT  7
#define ADAFRUIT_CC3000_CS    10

// Create CC3000 instance
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
// Create aREST instance
aREST rest = aREST();

// Your WiFi SSID and password                                         
#define WLAN_SSID       "ssid"
#define WLAN_PASS       "password"

// The port to listen for incoming TCP connections 
#define LISTEN_PORT           80

// Server instance
Adafruit_CC3000_Server restServer(LISTEN_PORT);

// DNS responder instance
MDNSResponder mdns;

// Variables to be exposed to the API
int temperature;
int humidity;

void setup(void)
  // Start Serial
  // Init variables and expose them to REST API
  temperature = 24;
  humidity = 40;

  // Function to be exposed
  // Give name and ID to device
  // Set up CC3000 and get connected to the wireless network.
  if (!cc3000.begin())
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
  while (!cc3000.checkDHCP())
  // Print CC3000 IP address. Enable if mDNS doesn't work
  //while (! displayConnectionDetails()) {
   // delay(1000);
  // Start multicast DNS responder
  if (!mdns.begin("arduino", cc3000)) {
  // Start server
  Serial.println(F("Listening for connections..."));

void loop() {
  // Handle any multicast DNS requests
  // Handle REST calls
  Adafruit_CC3000_ClientRef client = restServer.available();

// Print connection details of the CC3000 chip
bool displayConnectionDetails(void)
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    return true;

// Custom function accessible by the API
int ledControl(String command) {
  // Get state from command
  int state = command.toInt();
  return 1;

Am not sure if you have figured it out but the problem is the baud rate setting on ur terminal window. At the bottom right change the baud from 9600 to 115200 which is what it is set for in the setup part of the code.

Oh thank you for your concern, but I am still wondering what those strange characters represent or mean.

That is the serial port's attempt to make sense of an incoming async serial stream that has different settings than the ones the port is using. In order for the receiver to receive what was sent, the sender and receiver need to use the same settings. If the settings are different, the receiver will receive garbage.