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.
Revision 0:4568a8086f47, committed 2010-05-31
- Comitter:
- martin
- Date:
- Mon May 31 18:20:25 2010 +0000
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon May 31 18:20:25 2010 +0000
@@ -0,0 +1,45 @@
+// Writes hex over SPI from pc input
+
+#include "mbed.h"
+
+SPI spi(p5, p6, p7); // mosi, miso, sclk
+DigitalOut cs(p10);
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+int main() {
+ spi.format(8,3);
+ spi.frequency(1000000);
+ wait(0.1);
+
+while(1){
+
+
+int n;
+pc.printf("hex: ");
+pc.scanf("%xx", &n);
+pc.printf("%xx", n);
+
+ int o;
+
+pc.printf("hex2: ");
+pc.scanf("%xx", &o);
+pc.printf("%xx", o);
+
+ // Select the device
+ cs=0;
+ int dataA = spi.write(n);
+ //wait(0.01);
+ int dataB = spi.write(o);
+ cs=1;
+ pc.printf("Data out = 0x%X\n", dataA);
+
+
+ pc.printf("data out = 0x%X\n", dataB);
+ wait(0.1);
+
+
+
+}
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 31 18:20:25 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0