Cool Components Workshop Board

mbed LPC1768 Workshop Development Board (version 2 rev b) from Cool Components http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=608

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

/media/uploads/O_Shovah/mbed_lpc1768_workshop_development_board_-version_2_rev_b-.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"
#include "HTTPClient.h"

DigitalOut led(LED1);

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.coolcomponents.co.uk/catalog/advanced_search_result.php?keywords=", "mbed");

  // 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);
  }
}

USB A Mass Storage Test :

#include "mbed.h"
#include "MSCFileSystem.h"
//#include <stat.h>

#define FSNAME "msc"
MSCFileSystem msc(FSNAME);

int main()
{
    DIR *d;
    struct dirent *p;
    //struct stat st;
    //char path[PATH_MAX];
    
    printf("\n\n================================\n");
    printf("USB Mass storage demo program for mbed LPC1768\n");
    printf("================================\n\n");
    
    d = opendir("/" FSNAME);
    
    printf("\nList of files on the flash drive:\n");
    if ( d != NULL )
    {
        while ( (p = readdir(d)) != NULL )
        {
            printf(" - %s\n", p->d_name);
        }
    }
    else
    {
        error("Could not open directory!");
    }
    printf("\nTesting file write:\n");
    FILE *fp = fopen( "/" FSNAME "/msctest.txt", "w");
    if ( fp == NULL )
    {
        error("Could not open file for write\n");
    }
    fprintf(fp, "Hello mass storage!");
    fclose(fp); 
    printf("\n - OK\n");

    printf("\nTesting file read:\n");
    fp = fopen( "/" FSNAME "/msctest.txt", "r");
    if ( fp == NULL )
    {
        error("Could not open file for read\n");
    }
    char buf[256];
    if ( NULL == fgets(buf, sizeof(buf), fp) )
    {
        error("Error reading from file\n");
    }
    fclose(fp); 
    printf("\n - OK, read string: '%s'\n\n", buf);
}

Discussion topics

Nothing here yet!

Questions

Nothing here yet!