Permalink
Browse files

modified nfc shield libs

  • Loading branch information...
1 parent 31c70bc commit 475b636b6814dfeb4d94d44b2d7ab45a086e7740 @nelsonz nelsonz committed Jul 22, 2012
@@ -132,17 +132,12 @@ void Adafruit_NFCShield_I2C::PrintHex(const byte * data, const uint32_t numBytes
uint32_t szPos;
for (szPos=0; szPos < numBytes; szPos++)
{
- Serial.print("0x");
// Append leading 0 for small values
if (data[szPos] <= 0xF)
Serial.print("0");
Serial.print(data[szPos], HEX);
- if ((numBytes > 1) && (szPos != numBytes - 1))
- {
- Serial.print(" ");
- }
}
- Serial.println("");
+ Serial.print("\n");
}
/**************************************************************************/
View
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <script src="jquery.js"></script>
+ <script src="syncpad.js"></script>
+ <link rel="stylesheet" href="syncpad.css">
+</head>
+<body>
+ <a href="#" class="button" id="write">Write tag</a>
+</body>
+</html>
View
@@ -0,0 +1,12 @@
+{
+ "BundleType": "Application",
+ "BundleIdentifier": "syncpad",
+ "AppName": "SyncPad",
+ "AppDescription": "NFC Sync",
+ "RequiredPermissions": [
+
+ ],
+ "SupportedLanguages": [
+ "en"
+ ]
+}
View
@@ -0,0 +1,31 @@
+.button {
+ -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
+ -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
+ box-shadow:inset 0px 1px 0px 0px #ffffff;
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
+ background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
+ background-color:#ededed;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+ border-radius:6px;
+ border:1px solid #dcdcdc;
+ display:inline-block;
+ color:#777777;
+ font-family:arial;
+ font-size:15px;
+ font-weight:bold;
+ padding:6px 24px;
+ text-decoration:none;
+ text-shadow:1px 1px 0px #ffffff;
+}
+.classname:hover {
+ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );
+ background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
+ background-color:#dfdfdf;
+}
+.classname:active {
+ position:relative;
+ top:1px;
+}
View
@@ -0,0 +1,35 @@
+var LOCAL = 'ws://localhost:9000',
+ CLOUD = 'http://192.168.1.192';
+
+var sp = getSpotifyApi(1),
+ player = sp.require('sp://import/scripts/api/models').player,
+ exports.init = init;
+
+function init() {
+ var ws = new WebSocket(LOCAL);
+
+ ws.onopen = function(){
+ ws.send(JSON.stringify({type: 'announce', announce: 'song'}));
+ };
+
+ ws.onclose = function(){
+ setTimeout(init, 5000);
+ };
+
+ ws.onmessage = function(msg) {
+ var data = JSON.parse(msg.data);
+ if (!data.write) {
+ player.play("spotify:track:" + data.track);
+ player.position = data.position;
+ }
+ if (data.write) {
+ $.post(CLOUD + '/store/' + data.id, {type: 'song', track: player.track.uri, position: player.position});
+ }
+ }
+
+ $("#write").on('click', function(e) {
+ ws.send(JSON.stringify({type: 'write'}));
+ });
+}
+
+

0 comments on commit 475b636

Please sign in to comment.