Romilly Cocking / Mbed 2 deprecated Ser23K256Example

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Ser23K256.h"
00003 
00004 
00005 SPI spi(p5,p6,p7);
00006 Ser23K256 sram(spi,p14);
00007 
00008 
00009 int main() {
00010     char buff[50];
00011     sram.write(0, 'h');
00012     sram.write(1, 'i');
00013     sram.write(2, '!');
00014     sram.write(3, '\0');
00015     for (int address = 0; address < 4; address++) {
00016         buff[address] = sram.read(address);
00017     }
00018     printf("sram = %s\r\n", buff);
00019     sram.write(0, "Hello world!",12);
00020     sram.read(0, buff, 12);
00021     buff[12]='\0';
00022     printf("now = %s\r\n", buff);
00023 }