Base code for the spi master

Dependencies:   mbed

spi_master.cpp

Committer:
chaos5338
Date:
2015-12-14
Revision:
0:50fdc77f2817

File content as of revision 0:50fdc77f2817:

// CECS 447 SPI Master Test
#include "mbed.h"
    
    // default is 8 bits, mode 1, 
    // Instantiante Functions and Classes
    SPI device(p11, p12, p13);
    DigitalOut cs(p14);
    DigitalIn myButton(p23);
    Serial pc(USBTX, USBRX); // tx, rx

    
    int main(){
    pc.baud(9600);
    pc.printf("Starting transmission.\n\r");
    cs = 0;
    if (myButton){
        int response = device.write(0xFF);
        cs = 1;
        }
    }