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.
Fork of CatPotI2CSlavetest by
Revision 0:dcc9cf1071f1, committed 2014-12-15
- Comitter:
- ryuna
- Date:
- Mon Dec 15 07:37:14 2014 +0000
- Child:
- 1:178963fb9f75
- Commit message:
- ver.1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Ping.lib Mon Dec 15 07:37:14 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/ryuna/code/Ping/#6be59631152a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Dec 15 07:37:14 2014 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include "Ping.h"
+
+#define SYSAHBCLKDIV_Val 0x00000001 // Reset: 0x001
+#define CLOCK_SETUP 1 // デフォルト=1
+#define SYSPLLCTRL_Val 0x00000023 // デフォルト=23 Reset: 0x000
+#define SYSPLLCLKSEL_Val 0x00000001 // デフォルト=0 Reset: 0x000
+#define MAINCLKSEL_Val 0x00000003 // デフォルト=3 Reset: 0x000
+
+
+#define ADDRESS 0xA0
+#define DATA_NUM 5
+
+DigitalOut myled(LED1);
+I2CSlave Tiny(dp5, dp27);
+Ping Sensor(dp1,dp2);
+Serial pc(USBTX, USBRX);
+
+int main() {
+
+ char Export[DATA_NUM]={0};
+ uint8_t cycle=0;
+
+ Tiny.address(ADDRESS);
+ //Tiny.frequency(9600);
+
+ while(1) {
+
+
+ Sensor.Send();
+ wait_ms(30);
+ Export[cycle%DATA_NUM] = 0xAA;//Sensor.Read_cm();
+
+ cycle++;
+
+ switch(Tiny.receive()){
+
+ case I2CSlave::ReadAddressed:
+ Tiny.write(Export, DATA_NUM); // Includes null char
+ break;
+ case I2CSlave::WriteGeneral:
+ break;
+ case I2CSlave::WriteAddressed:
+ break;
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 15 07:37:14 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
