Music Box's Code

Dependencies:   MusicEngine TSL2561 mbed

スイッチサイエンスマガジンのmbedで手作りオルゴール記事中で使用しているプログラムです。

Files at this revision

API Documentation at this revision

Comitter:
switchscience
Date:
Mon Jun 08 05:58:14 2015 +0000
Commit message:
Father's day gift

Changed in this revision

MusicEngine.lib Show annotated file Show diff for this revision Revisions of this file
TSL2561.lib Show annotated file Show diff for this revision Revisions of this file
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/MusicEngine.lib	Mon Jun 08 05:58:14 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/taylorza/code/MusicEngine/#4f7c4255997a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSL2561.lib	Mon Jun 08 05:58:14 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/kenjiArai/code/TSL2561/#25a700e9b8ec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 08 05:58:14 2015 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015 Switch Science, Inc.
+ *      https://international.switch-science.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include "mbed.h"
+#include "MusicEngine.h"
+#include "TSL2561.h"
+
+
+I2C  i2c( dp4,dp5);
+TSL2561      lum( i2c , TSL2561_ADDRESS_FLOAT );         // TSL2561 SDA, SCL (Data available every 400mSec)      // TSL2561 SDA, SCL (Data available every 400mSec)
+
+
+MusicEngine Speaker(dp15);
+Serial pc(USBTX, USBRX);
+int brightness = 15;
+
+int main()
+{
+    pc.baud(9600);
+
+    while(1) {
+        pc.printf("Illuminance: %+7.2f [Lux]\r\n", lum.lux());
+        if(lum.lux() > brightness) {
+            Speaker.play("T120L4CDEFEDCREFGAGFERCR4CR4CR4CR4CDEFEDC");
+            wait(15);
+        }
+        wait(1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 08 05:58:14 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file