Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 SPI spi(PA_7, PA_6, PA_5); // mosi, miso, sclk 00004 DigitalOut cs(PB_6); 00005 DigitalOut syncPin (D8); 00006 00007 Serial pc(USBTX, USBRX, 9600); // tx, rx 00008 00009 int main() { 00010 00011 // set sync pin to known state 00012 syncPin = 0; 00013 // Chip must be deselected 00014 cs = 1; 00015 int value = 4; 00016 00017 spi.format(8,3); // Setup: bit data, high steady state clock, 2nd edge capture 00018 spi.frequency(1000000); //1MHz 00019 00020 // set sync pin high 00021 syncPin = 1; 00022 for (int i = 0; i < 6; i++) { 00023 // Select device 00024 cs = 0; 00025 spi.write(value); 00026 // Deselect device 00027 cs = 1; 00028 value++; 00029 } 00030 }
Generated on Wed Jul 20 2022 06:54:39 by
1.7.2