You are viewing an older revision! See the latest version

Cool Components Workshop Board

The workshop breakout board is a simple, compact board for experimenting with the Mbed. It offers a micro SD card slot, USB A, USB B, and ethernet port (with magnetics). In addition, each mbed pin can be connected to via a solderless header.

/media/uploads/coolcomponents/_scaled_mbedworkshop.jpg /media/uploads/coolcomponents/mbedworkshop.png

Orientation : A simple thing, but lots of people get it wrong. The mbed should be inserted into the board socket so that its USB mini B connector is directly over the mini SD slot.

SD Card Test Code : (This code or probably the library it uses does not work with 100% of SD cards)

#include "mbed.h"
#include "SDFileSystem.h"
 
SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs, name
 
DigitalOut myled1(LED1);
DigitalOut myled3(LED3);
 
int main() {
    printf("Hello World!\n");  
    myled3=1;
 
    FILE *fp = fopen("/sd/sdtest.txt", "w");
    if(fp == NULL) {
        error("Could not open file for write\n");
        myled1=1;
        myled3=0;
    }
    fprintf(fp, "If you're reading this text in a file, your SD card has been written to...");
    fclose(fp);
}

Ethernet Jack Test Code :

#include "mbed.h"
// import Library from http://mbed.org/projects/cookbook/svn/EMAC/lwip/trunk
// Name: HTTPClient
#include "HTTPClient.h"

DigitalOut led(LED1);

// see http://mbed.org/projects/cookbook/api/EMAC/lwip/trunk/HTTPClient/HTTPClient#HTTPClient.HTTPClientd
HTTPClient http("monkeychuff",                 // Brings up the device with static IP address and domain name.
                IPv4(192,168,0,123),   // IPv4 address
                IPv4(255,255,255,0),    // netmask
                IPv4(192,168,0,1),     // default gateway
                IPv4(192,168,0,1));    // dns server
                
LocalFileSystem local("local");
/**
 * Request a google search for HelloWorld and display the first 2000 characters 
 * of the page source on the serial terminal.
 */
int main(void) {
  char url[256];

  // Open a file to write.
  FILE *fd = fopen("/local/hello.htm", "w");

  // Insert the search term into the URL
  sprintf(url, "http://www.google.co.uk/search?hl=en&q=%s&btnG=Search&meta=", "HelloWorld");

  // Request a page and store it into a file.
  http.get(url, fd);

  // Close the file.
  fclose(fd);

  // The file is written on the local disk.
  // "/hello.htm" Have a look.

  // Work is done!
  while(1) {
    led = !led;
    wait(0.2);
  }
}

All wikipages