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.
Dependencies: MjTextileSensor mbed
Revision 0:99c77b75a3d4, committed 2015-07-01
- Comitter:
- matsujirushi
- Date:
- Wed Jul 01 13:59:55 2015 +0000
- Commit message:
- created.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MjTextileSensor.lib Wed Jul 01 13:59:55 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/matsujirushi/code/MjTextileSensor/#9f5d5e904cb9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jul 01 13:59:55 2015 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "MjTextileSensor.h"
+
+Serial pc(USBTX, USBRX);
+I2C i2c(p28, p27);
+MjTextileSensor sensor(&i2c, 0x84);
+
+int main()
+{
+ pc.baud(57600);
+ i2c.frequency(400000);
+
+ uint8_t majorVersion;
+ uint8_t minorVersion;
+ sensor.GetVersion(&majorVersion, &minorVersion);
+ pc.printf("Firmware version is %u.%u.\r\n", majorVersion, minorVersion);
+
+ for (;;) {
+ uint8_t values[10];
+ int valuesCount = sensor.GetSensorValues(values, sizeof (values));
+ if (valuesCount != 10) {
+ continue;
+ }
+
+ for (int i = 0; i < valuesCount; i++) {
+ pc.puts("\x1bM");
+ }
+ for (int i = 0; i < valuesCount; i++) {
+ pc.printf("%3u ", values[i]);
+ int j;
+ for (j = 0; j < values[i] / 2; j++) {
+ pc.putc('*');
+ }
+ for (; j < 255 / 2; j++) {
+ pc.putc('_');
+ }
+ pc.puts("\r\n");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 01 13:59:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file