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 DigitalOut red_led( LED_RED ); 00004 //DigitalOut green_led ( LED_GREEN ); 00005 DigitalOut ss( PTD0 ); 00006 00007 00008 int main() { 00009 00010 SPI spi_master( PTD2, PTD3, PTD1 ); 00011 spi_master.format( 8, 1 ); 00012 spi_master.frequency( 100000 ); 00013 ss = 1; 00014 00015 //red_led = 1; 00016 //green_led = 1; 00017 00018 00019 uint8_t sent = 0; 00020 00021 while(1) { 00022 ss = 0; 00023 00024 spi_master.write( sent ); 00025 int rcvd = spi_master.write( 0x55 ); 00026 00027 ss = 1; 00028 00029 00030 if( rcvd != sent ){ 00031 red_led = 0; 00032 while(1){}; 00033 } 00034 else{ 00035 red_led = 1; 00036 } 00037 00038 sent++; 00039 00040 wait(0.2); 00041 } 00042 }
Generated on Mon Jul 25 2022 08:30:53 by
1.7.2