Global variables use 1,124 bytes (54%) of dynamic memory, leaving 924 bytes for local variables. Maximum is 2,048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x63
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x63
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
//include necessary libraries
#include <Adafruit_CC3000.h>
#include "MotorDriver.h"
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
SPI_CLOCK_DIVIDER); // you can change this clock speed
#define WLAN_SSID "Wentworth" // cannot be longer than 32 characters!
#define WLAN_PASS "dawsonliam"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define LISTEN_PORT 80 // What TCP port to listen on for connections.
// The HTTP protocol uses port 80 by default.
#define MAX_ACTION 10 // Maximum length of the HTTP action that can be parsed.
#define MAX_PATH 64 // Maximum length of the HTTP request path that can be parsed.
// There isn't much memory available so keep this short!
#define BUFFER_SIZE MAX_ACTION + MAX_PATH + 20 // Size of buffer for incoming request data.
// Since only the first line is parsed this
// needs to be as large as the maximum action
// and path plus a little for whitespace and
// HTTP version.
#define TIMEOUT_MS 500 // Amount of time in milliseconds to wait for
// an incoming request to finish. Don't set this
// too high or your server could be slow to respond.
Adafruit_CC3000_Server httpServer(LISTEN_PORT);
uint8_t buffer[BUFFER_SIZE+1];
int bufindex = 0;
char action[MAX_ACTION+1];
char path[MAX_PATH+1];
String webClickRequest;
void setup(){
// initialize the digital pin as an output.
motordriver.init();
motordriver.setSpeed(200,MOTORB);
motordriver.setSpeed(200,MOTORA);
Serial.begin(115200);
Serial.println(F("Hello, CC3000!\n"));
Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC);
// Initialise the module
Serial.println(F("\nInitializing..."));
if (!cc3000.begin())
{
Serial.println(F("Couldn't begin()! Check your wiring?"));
while(1);
}
Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
Serial.println(F("Failed!"));
while(1);
}
Serial.println(F("Connected!"));
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100); // ToDo: Insert a DHCP timeout!
}
// Start listening for connections
httpServer.begin();
Serial.println(F("Listening for connections..."));
}
void loop(){
// Try to get a client which is connected.
Adafruit_CC3000_ClientRef client = httpServer.available();
if (client) {
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read the incoming HTTP request
if (webClickRequest.length() < 100) {
//store the request to a string
webClickRequest += c;
}
//check to see if the request has come to an end
if (c == '\n') {
//Begin drawing out the website using
//using basic HTML formatting with some CSS
client.println(F("HTTP/1.1 200 OK"));
client.println(F("Content-Type: text/html"));
client.println();
client.println(F("<HTML>"));
client.println(F("<HEAD>"));
client.println(F("<TITLE>Internet Controlled RC Car</TITLE>"));
client.println(F("<STYLE>"));
client.println(F("body{margin:50px 0px; padding:0px; text-align:center;}"));
client.println(F("h1{text-align: center; font-family:\"Trebuchet MS\",Arial, Helvetica, sans-serif; font-size:24px;}"));
client.println(F("a{text-decoration:none; width:75px; height:50px; border-color:black; font-family:\"Trebuchet MS\",Arial, Helvetica, sans-serif; padding:6px; background-color:#aaaaaa; text-align:center; border-radius:10px 10px 10px; font-size:24px;}"));
client.println(F("a:link {color:white;}"));
client.println(F("a:visited {color:white;}"));
client.println(F("a:hover {color:red;}"));
client.println(F("a:active {color:white;}"));
client.println(F("</STYLE>"));
client.println(F("</HEAD>"));
client.println(F("<BODY>"));
client.println(F("<H1>Internet Controlled RC Car</H1>"));
client.println(F("
"));
client.println(F("
"));
client.println(F("<a href=\"/?left\"\">LEFT</a>"));
client.println(F(" "));
client.println(F("<a href=\"/?forward\"\">FORWARD</a>"));
client.println(F(" "));
client.println(F("<a href=\"/?right\"\">RIGHT</a>"));
client.println(F("
"));
client.println(F("
"));
client.println(F("
"));
client.println(F("<a href=\"/?backleft\"\">BACK LEFT</a>"));
client.println(F("<a href=\"/?back\"\">BACK</a>"));
client.println(F(" "));
client.println(F("<a href=\"/?backright\"\">BACK RIGHT</a>"));
client.println(F("</BODY>"));
client.println(F("</HTML>"));
//Stop loading the website
delay(1);
client.stop();
//check to see if any of the drive commands have been sent
//from the webpage to the Arduino
if(webClickRequest.indexOf("?left") > 0){
Serial.println(F("hello"));
motordriver.goLeft();
delay(1000);
motordriver.stop();
}
else if(webClickRequest.indexOf("?forward") >0){
motordriver.goForward();
delay(1000);
motordriver.stop();
}
else if(webClickRequest.indexOf("?right") >0){
motordriver.goRight();
delay(1000);
motordriver.stop();
}
else if(webClickRequest.indexOf("?backleft") >0){
motordriver.goLeft();
motordriver.goBackward();
delay(1000);
motordriver.stop();
}
else if(webClickRequest.indexOf("?back") >0){
motordriver.goBackward();
delay(1000);
motordriver.stop();
}
else if(webClickRequest.indexOf("?backright") >0){
motordriver.goRight();
motordriver.goBackward();
delay(1000);
motordriver.stop();
}
//clear the string for the new incoming data
webClickRequest="";
}
}
}
}
}
}