|
一周精彩回顾:2017.12.4-2017.12.10
[复制链接]
hello,早上好~现在是一周回顾时间,快来看看都有哪些精彩好料把~精彩好贴推荐:
@辛昕
因为乱改代码而被炒鱿鱼甚至祭天的程序员
@lz15229
tl494升压带负载
@飞扬自我
EEWORLD DIY-语音控制LED灯
@北方
EEWORLD DIY-无线电子冰箱贴
- <!DOCTYPE html>
- <html>
- <!--
-
- -->
- <head>
-
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, user-scalable=no
- initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
-
- <title>eSticker</title>
-
- <style>
- [url=home.php?mod=space&uid=568594]@import[/url] 'ui/css/evothings-app.css';
- </style>
-
-
- <script src="cordova.js"></script>
- <script src="libs/jquery/jquery.js"></script>
- <script src="libs/evothings/evothings.js"></script>
- <script src="libs/evothings/ui/ui.js"></script>
- <script src="libs/evothings/arduinoble/arduinoble.js"></script>
- <script src="libs/pubnub.4.18.0.js"></script>
- <!-- or <script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.18.0.js"></script> -->
-
-
- </head>
-
- <body><!-- enables low-delay CSS transitions. -->
-
- <header>
- <button class="back">
- <img src="./ui/images/arrow-left.svg" />
- </button>
-
- <img class="logotype" src="./ui/images/logoesticker.png" alt="eSticker" />
-
- <!--<button class="menu"><img src="ui/images/menu.svg" /></button>-->
- </header>
-
- <h1>eSticker</h1>
-
- <p id="info">Initializing...</p>
-
- <!--
- <button class="yellow wide">CONNECT</button>
- //New empty Keys
- pubnub = new PubNub({
- publishKey: 'pub-c-218bb0fd-bdb4-45c6-a1c4-77d7674c8caf',
- subscribeKey: 'sub-c-383e74cc-d0e3-11e7-b07a-4e4fd9aca72d'
- })
- -->
-
- <br />
-
- <input type="text" id="txtag" value="input text...">
-
- <button class="green wide big">Sent Text</button>
-
- <br />
-
- <button class="red wide big">Clear Text</button>
-
- <script>
- // Application object.
- var app = {}
-
- var pubnub = new PubNub({
- subscribeKey: 'sub-c-81c369ca-5ba6-11e7-a298-xxxxxxxxxxx', // always required
- publishKey: 'pub-c-6a7a7381-128c-4d9b-b3af-xxxxxxxxxxxxxx' // only required if publishing
- });
-
- // Function PublishMessage.
- function publishMessage(txMessage) {
- console.log("Since we're publishing on subscribe connectEvent, we're sure we'll receive the following publish.");
- var publishConfig = {
- channel : "flood_alarm_signal",
- message : txMessage
- }
- pubnub.publish(publishConfig, function(status, response) {
- console.log(status, response);
- })
- };
-
-
- // Connected device.
- app.device = null;
- var count=0;
-
- // Add listener and subscribing
- pubnub.addListener({
- status: function(statusEvent) {
- if (statusEvent.category === "PNConnectedCategory") {
- publishMessage("PNConnected!");
- }
- },
- message: function(message) {
- console.log("New Message!!", message);
- count=count+1;
- //app.showMessage(message.message);
- app.showMessage(message.message);
- },
- presence: function(presenceEvent) {
- // handle presence
- }
- });
- pubnub.subscribe({
- channels: ['flood_alarm_signal']
- });
-
-
-
-
- // Turn on LED.
- app.sentTX = function()
- {
- var txSent=new Uint8Array();
- txSent=document.getElementById('txtag').value;
- app.device && app.device.writeDataArray(new Uint8Array([txSent]), '19b10001-e8f2-537e-4f6c-d104768a1214');
-
- var txMessage = txSent;
- publishMessage(txMessage) ;
-
- //app.showMessage(txMessage.text);
- }
-
- // Turn off LED.
- app.clearTX = function()
- {
- document.getElementById('txtag').value = " ";
- app.device && app.device.writeDataArray(new Uint8Array([0]), '19b10001-e8f2-537e-4f6c-d104768a1214');
- }
-
- app.showMessage = function(info)
- {
- document.getElementById('info').innerHTML = info
- };
-
- // Called when BLE and other native functions are available.
- app.onDeviceReady = function()
- {
- app.showMessage('Touch the connect button to begin.');
- };
-
- app.connect = function()
- {
- evothings.arduinoble.close();
-
- app.showMessage('Connecting...');
-
- evothings.arduinoble.connect(
- 'TAG', // Advertised name of BLE device.
- function(device)
- {
- app.device = device;
- app.showMessage('Connected! Touch buttons to turn LED on/off.');
- },
- function(errorCode)
- {
- app.showMessage('Connect error: ' + errorCode + '.');
- });
- };
-
- document.addEventListener(
- 'deviceready',
- function() { evothings.scriptsLoaded(app.onDeviceReady) },
- false);
- </script>
-
- </body>
-
- </html>
复制代码
@shinykongcn
TI BLE-Stack examples Mac CCS 运行
@qwerghf
新出Amazon FreeRTOS你有啥想法
光继电器性能怎么样?光继电器如何选型?
@cardin6
【Zbrush数字雕刻】小怪兽龙 类似克苏鲁造型
精彩活动推荐:
25美分实现25种功能的TI MSP430铁电超值微控制器方案即将直播!快来报名围观!
RMB 999,即可踏入PC-based测量世界!低价位 USB DAQ数据采集设备邀您来答题
下载设计资源,赢取“会说话”的啤酒托!
证明自己,VICOR技术问题测试问卷,等您来挑战!好礼等您拿!
一起分享,共同成长!EEWORLD月月有奖优秀主题/回复第29期
|
|
|
|
|
加EE小助手好友, 入技术交流群 |
EE服务号 精彩活动e手掌握 |
EE订阅号 热门资讯e网打尽 |
聚焦汽车电子软硬件开发 认真关注技术本身 |
|