A WiFiDipCortex based robot. Control is via sockets over WiFi. See also: https://github.com/mfurseman/robo-android

Dependencies:   Motordriver USBDevice cc3000_hostdriver_mbedsocket_hacked mbed

Files at this revision

API Documentation at this revision

Comitter:
mfurseman
Date:
Sat Oct 18 02:28:52 2014 +0000
Child:
1:b66a2d756c8a
Commit message:
Working connection after smartconfig setup

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
cc3000_hostdriver_mbedsocket.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sat Oct 18 02:28:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#37f14e05bfd7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cc3000_hostdriver_mbedsocket.lib	Sat Oct 18 02:28:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/cc3000_hostdriver_mbedsocket/#ca8c234997c0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 18 02:28:52 2014 +0000
@@ -0,0 +1,73 @@
+#include "mbed.h"
+#include "cc3000.h"
+#include "USBSerial.h"
+
+/* Quickly change debug flag to remove blocking serial code */
+#define DEBUG
+#ifdef DEBUG
+USBSerial serial;
+#define debug(x, ...) serial.printf(x, ##__VA_ARGS__);
+#else
+#define debug(x, ...)
+#endif
+
+using namespace mbed_cc3000;
+
+/* On board LED */
+DigitalOut led(P0_1);
+
+/* Serial library for WiFi module */
+cc3000 wifi(p28, p27, p30, SPI(p21, p14, p37));
+
+/* Struct to hold connection data */
+tNetappIpconfigRetArgs ipinfo;
+
+
+void printConnectionInfo() {
+    if (( wifi.is_enabled() ) && ( wifi.is_dhcp_configured() )) {
+        wifi.get_ip_config(&ipinfo);
+    }    
+    debug("\r\n");
+    if (! wifi.is_enabled() ) {
+        debug("CC3000 Disabled\r\n"); 
+    }
+    else if ( wifi.is_dhcp_configured() ) {
+        debug("SSID : %-33s|\r\n", ipinfo.uaSSID);
+        debug("IP : %-35s|\r\n", wifi.getIPAddress());   
+    }
+    else if ( wifi.is_connected() ) {
+        debug("Connecting, waiting for DHCP\r\n"); 
+    }
+    else {
+        debug("Not Connected\r\n");   
+    }
+}
+
+int main(void) {
+    NVIC_SetPriority(SSP1_IRQn, 0x0); 
+    NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
+    
+    // SysTick set to lower priority than Wi-Fi SPI bus interrupt
+    NVIC_SetPriority(SysTick_IRQn, 0x2); 
+    
+    // Enable RAM1
+    LPC_SYSCON->SYSAHBCLKCTRL |= (0x1 << 26);
+        
+    wait(1);
+    printConnectionInfo();
+
+    wifi.start(0);
+    printConnectionInfo();
+    
+    wait_ms(750);
+
+    wifi._wlan.ioctl_set_connection_policy(0, 0, 1);
+    printConnectionInfo();
+
+    while(1) {
+        printConnectionInfo();
+        debug("test message\r\n");
+        led = !led;
+        wait(1);
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 18 02:28:52 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file