当前位置: 首页 > news >正文

网站运维服务内容wordpress 左侧浮动

网站运维服务内容,wordpress 左侧浮动,怎么开发一个微信商城,老闵行发展粒子网格算法 pmThis post is originally from my blog on www.jaredwolff.com.这篇文章最初来自我在www.jaredwolff.com上的博客。 Writing an app takes time. It takes even more time to write one that works with hardware.编写应用程序需要时间。 编写与硬件兼容的代码…粒子网格算法 pmThis post is originally from my blog on www.jaredwolff.com. 这篇文章最初来自我在www.jaredwolff.com上的博客。 Writing an app takes time. It takes even more time to write one that works with hardware. 编写应用程序需要时间。 编写与硬件兼容的代码需要花费更多时间。 Luckily theres a solution to this problem. 幸运的是有一个解决此问题的方法。 Enter Blynk. 输入Blynk 。 Its an app that connects to your hardware. It has a drag and drop interface with pre built widgets. That means you can build an app in seconds. Then upload your device sensors readings within minutes. 这是一个连接到您的硬件的应用程序。 它具有带有预构建小部件的拖放界面。 这意味着您可以在几秒钟内构建一个应用程序。 然后在几分钟之内上传设备传感器的读数。 Blynk does work with Argon, Boron or ethernet connected Xenon. Unfortunately it doesnt work over a Particle Mesh network. In this article youll learn some of the workarounds to get your mesh based projects up an running. Blynk可以与氩气硼或以太网连接的氙气一起使用。 不幸的是它不能在粒子网格网络上工作。 在本文中您将学习一些变通方法以使基于网格的项目正常运行。 从粒子云到布林克 (From Particle Cloud to Blynk) Lets start with the most simple use case: getting data from any Particle Device to Blynk. 让我们从最简单的用例开始将数据从任何粒子设备获取到Blynk。 The Air Quality data from Particle Squared is perfect for this example. So, ill be using that. 对于这个例子来自Particle Squared的空气质量数据是完美的。 所以我将使用它。 First lets create a new Blynk Project 首先让我们创建一个新的Blynk项目 Grab the Auth Token well need that in a bit. You can tap the Auth Token to copy it to your clipboard. 取得Auth Token我们稍后将需要它。 您可以点击身份验证令牌将其复制到剪贴板。 Next, lets add a SuperChart for this example. 接下来让我们为该示例添加一个超级图表 。 Configure the SuperChart to use a Virtual Pin. We dont have access to the actual hardware pins on the device. V0 is a good choice. 配置超级图表以使用虚拟引脚。 我们无权访问设备上的实际硬件引脚。 V0是一个不错的选择。 To update values in Blynk, well have to connect somehow. The best way is to use an Integration in the Particle Console. 要更新Blynk中的值我们必须以某种方式进行连接。 最好的方法是在粒子控制台中使用集成 。 In Particle Console, click the icon below the terminal icon. Then click on New Integration. 在粒子控制台中单击终端图标下方的图标。 然后单击“ 新集成”。 Look at the example below to see how I filled everything out. 查看下面的示例看看我如何填写所有内容。 Particle Squared uses the Event Name as ****blob. For other projects this may be different. Remember: your event name is the same as from Particle.publish(eventName, data). 粒子平方将事件名称用作**** blob 。 对于其他项目可能会有所不同。 请记住您的事件名称与来自Particle.publish(eventName, data)名称相同。 The URL is set to use the blink-cloud.com address. According to their API a sample URL looks like: 该URL设置为使用blink-cloud.com地址。 根据他们的APIURL示例如下 Ill also include it here so its easier to copy 我也将其包含在此处以便于复制 http://blynk-cloud.com/auth_token/update/pin?valuevalueReplace auth_token with the Auth Token we got earlier. 将auth_token替换为我们之前获得的Auth令牌 。 Replace pin with the virtual pin we want to modify. In this case V0 将pin替换为我们要修改的虚拟引脚。 在这种情况下 V0 Replace the value with the value you want to use. 用您要使用的值替换该value 。 Well reference one of the values in the Particle Squared blob. Its organized like this: 我们将引用“粒子平方” blob中的值之一。 它的组织方式如下 {temperature: 28.60,humidity: 45.00,sgp30_tvoc: 18,sgp30_c02: 400,bme680_temp: 27.36,bme680_pres: 1012.43,bme680_hum: 43.80,bme680_iaq: 43.90,bme680_temp_calc: 27.30,bme680_hum_calc: 43.97 }Particle uses mustache templates. As you can see in the screenshot above, you can set value to {{{temperature}}}. 粒子使用胡须模板 。 如您在上面的屏幕截图中所见您可以将value设置为{{{temperature}}} 。 Note: If youre working on your own project, its important to publish with JSON. As a reference the Particle.publish command looks like: 注意如果您正在处理自己的项目则使用JSON发布非常重要。 作为参考 Particle.publish命令如下所示 // Publish data Particle.publish(blob, String::format({\temperature\:%.2f,\humidity\:%.2f},si7021_data.temperature, si7021_data.humidity) , PRIVATE, WITH_ACK);Click the big blue Save button at the bottom of the screen. Then we can move on to the next step! 点击屏幕底部的蓝色大保存按钮 。 然后我们可以继续下一步 测试中 (Testing) Since creating our Particle Webhook Integration, its been publishing data to Blynk. Lets go see if its working. 自创建我们的Particle Webhook集成以来它一直在将数据发布到Blynk。 让我们看看它是否正在工作。 First, lets go back to the Blynk app. Hit the Play Button in the top Right in Blynk screen. 首先让我们回到Blynk应用程序。 点击 Blynk屏幕右上方的“播放”按钮 。 If your integration has been running for a while, you should see the graph populate with data! In the case you dont see anything, lets check the logs. 如果您的集成已经运行了一段时间您应该会看到图形中填充了数据 如果您什么都看不到让我们检查一下日志。 Go back to your integration and scroll towards the bottom. We want to see if there are any errors. 返回到您的集成并滚动到底部 。 我们想看看是否有任何错误。 Not sure what that looks like? Heres an example of an integration with errors: 不确定是什么样子 这是一个有错误的集成示例 You can scroll further down to investigate why the error has occurred. 您可以进一步向下滚动以调查发生错误的原因。 All the way at the bottom shows the response from the server. Depending on the service, theyll give you information why your API call failed. In my case, I was missing values for two fields. 底部的所有方式均显示了服务器的响应。 根据服务的不同他们将为您提供API调用失败的原因。 就我而言我缺少两个字段的值。 Blynk的粒子正在运行 (Particle to Blynk is working!) You now have a basic way of publishing to a virtual pin in Blynk. There are drawbacks though. Most importantly, youll have to create an integration for every signal virtual pin. If you have eight readings, that means eight integrations. 您现在有了在Blynk中发布到虚拟图钉的基本方法。 虽然有缺点。 最重要的是您必须为每个信号虚拟引脚创建一个集成。 如果您有八个读数则意味着八个积分。 Bummer. 笨蛋 In the next section, youll learn a different way to configure Blynk. Lets go! 在下一节中您将学习配置Blynk的另一种方法。 我们走吧 使用Blynk库的局部网格 (Local Mesh Using Blynk Library) Unlike the first method, well be focusing on changing firmware only. 与第一种方法不同我们将只专注于更改固件。 We’ll use a Argon, Boron or Ethernet Connected Xenon and one regular Xenon. For the rest of this tutorial, well call these devices an “edge router”. 我们将使用氩硼或以太网连接的氙气和一个普通的氙气。 在本教程的其余部分中我们将这些设备称为“边缘路由器”。 The Xenon will run the Particle Squared code. Instead of using Particle.publish well be using Mesh.publish. This allows us to publish only to the local mesh network. Xenon将运行粒子平方代码。 而不是使用Particle.publish我们将使用Mesh.publish 。 这使我们只能发布到本地网状网络。 Meanwhile the edge router is listening for the message. It collects the values and then uses the Blynk API to publish to the app. 同时边缘路由器正在侦听消息。 它收集值然后使用Blynk API发布到应用程序。 Here are the steps: 步骤如下 设置我们的边缘路由器 (Setup our Edge Router) Pull up the menu by pressing CmdShiftP. Type Install Library. 按下Cmd Shift P上拉菜单。 键入安装库。 Then enter blynk. The library should download if you havent already. 然后输入blynk。 如果尚未下载该库则应下载。 Once installed you can include the library at the top of your .ino file like so: 安装后您可以将库包含在.ino文件顶部如下所示 #include blynk.hIn our setup() function lets init the Blynk library: 在我们的setup()函数中让我们初始化Blynk库 // Put initialization like pinMode and begin functions here. Blynk.begin(auth);In our setup() function, subscribe to the temperature event. The connected Xenon will generate this event. 在我们的setup()函数中订阅temperature事件。 连接的氙气将生成此事件。 // Subscribe to temperature events Mesh.subscribe(temperature,tempHandler);Define tempHandler like this for now: 现在像这样定义tempHandler // Temperature event handler for mesh void tempHandler(const char *event, const char *data){ }In the loop() function make sure we have Blynk.run(); 在loop()函数中确保我们有Blynk.run(); // loop() runs over and over again, as quickly as it can execute. void loop() {// The core of your code will likely live here.Blynk.run(); }Finally, for tempHandler we can add a debug print to monitor events. Ive used something like this: 最后对于tempHandler我们可以添加调试打印来监视事件。 我用过这样的东西 Serial.printlnf(event%s data%s, event, data ? data : NULL);Particle uses this in some of their examples. Its perfect for our purposes as well! 在他们的一些示例中Particle使用了此方法。 这对于我们的目的也是完美的 Note: make sure you have Serial.begin() called in your Setup() function! 注意确保在Setup()函数中调用了Serial.begin() So now we have tempHandler to receive data from the Xenon. The edge router can now take that data and upload it to Blynk. Lets use the Blynk.virtualWrite function for this: 所以现在我们有了tempHandler来接收来自氙气的数据。 边缘路由器现在可以获取该数据并将其上传到Blynk。 让我们为此使用Blynk.virtualWrite函数 // Write the data Blynk.virtualWrite(V0, data);This will write the temperature value from a Xenon to the V0 pin. If you used something other than V0, be sure to change that value here. (This is the same setup as the previous Particle Cloud to Blynk example) 这会将氙气的温度值写入V0引脚。 如果您使用的不是V0请确保在此处更改该值。 (这与前面的“ 粒子云到Blynk”示例的设置相同) The final code for the edge router should look something like this. Compile a flash it to your device when youre ready! 边缘路由器的最终代码应如下所示。 准备好将Flash编译到设备上 /** Project blynk-argon-forwarder* Description: Argon Blynk forwarder for Particle Mesh. Forwards data from mesh connected devices to Blynk.* Author: Jared Wolff* Date: 7/25/2019*/#include blynk.hchar auth[] ENTER YOUR AUTH KEY;// Temperature event handler for mesh void tempHandler(const char *event, const char *data){Serial.printlnf(event%s data%s, event, data ? data : NULL);// Write the dataBlynk.virtualWrite(V0, data); }// setup() runs once, when the device is first turned on. void setup() {// Serial for debuggingSerial.begin();// Put initialization like pinMode and begin functions here.Blynk.begin(auth);// Subscribe to temperature eventsMesh.subscribe(temperature,tempHandler);}// loop() runs over and over again, as quickly as it can execute. void loop() {// The core of your code will likely live here.Blynk.run();}Remember to set auth using the AUTH TOKEN in the Blynk app! 切记在Blynk应用程序中使用AUTH TOKEN设置auth 设置氙气 (Setting up a Xenon) Create a new project. This time it will be for the Xenon capturing temperature data. 创建一个新项目。 这次将是氙气捕获“温度数据”的时间。 Lets add a variable called time_millis to the top of the file. The type is system_tick_t. Well use it to create a simple delay timer for the temperature readings. 让我们在文件顶部添加一个名为time_millis的变量。 类型是system_tick_t 。 我们将使用它为温度读数创建一个简单的延迟计时器。 // Global variable to track time (used for temp sensor readings) system_tick_t time_millis;For the interval, lets use a preprocessor define 对于间隔让我们使用预处理器定义 #define INTERVAL_MS 2000Now lets tie those together in the loop() function. Well use an if statement to compare our current system time with that of the last event plus offset. If you ever need a simple timer, this is one of the best ways to do it! 现在让我们在loop()函数中将它们绑在一起。 我们将使用if语句将当前系统时间与上一个事件加偏移量的时间进行比较。 如果您需要一个简单的计时器这是最好的方法之一 // Check if our interval 2000msif( millis() - time_millis INTERVAL_MS ) {}Once were inside, make sure you reset timer_millis: 一旦进入内部请确保您重置timer_millis //Set time to the current time in millistime_millis millis();Then, well generate the temperature value using the random() function. Well use the two parameter variant. That way we can set the minimum value and the maximum value: 然后我们将使用random()函数生成温度值。 我们将使用两个参数的变体。 这样我们可以设置最小值和最大值 // Create a random numberint rand random(20,30);Finally well Mesh.publish the value: 最后我们将Mesh.publish值 // Publish our temperature valueMesh.publish(temperature,String::format(%d,rand));When this example runs, the temperature is broadcast to the mesh network. Then, the edge router receives it and forwards it on to Blynk! 运行此示例时温度将广播到网状网络。 然后边缘路由器将其接收并将其转发给Blynk You can flash this firmware whenever youre ready. Heres the full code for the Xenon so you can cross compare: 准备就绪后即可刷新此固件。 这是Xenon的完整代码因此您可以交叉比较 /** Project blynk-xenon-rgb* Description: Recieve RGB level from connected Edge Router. Sends simiulated temperature values via mesh to the Blynk cloud.* Author: Jared Wolff* Date: 7/25/2019*/// How often we update the temperature #define INTERVAL_MS 2000// Global variable to track time (used for temp sensor readings) system_tick_t time_millis; // setup() runs once, when the device is first turned on. void setup() {// Set time to 0time_millis 0;}// loop() runs over and over again, as quickly as it can execute. void loop() {// Check if our interval 2000msif( millis() - time_millis INTERVAL_MS ) {//Set time to the current time in millistime_millis millis();// Create a random numberint rand random(20,30);// Publish our temperature valueMesh.publish(temperature,String::format(%d,rand));}} 给它一个测试 (Give it a test!) Now that weve programmed both devices lets get them talking to each other. 现在我们已经为这两种设备编程了让我们让它们彼此交谈。 Ive already set up the Argon with a mesh network called 8f-9. Ill explain how to get the Xenon connected with the CLI. You can also used the Particle App. 我已经使用称为8f-9的网状网络设置了Argon 。 我将解释如何使Xenon与CLI连接。 您也可以使用粒子应用程序。 First, lets connect the Xenon to USB and get it into Listening Mode. After connect, hold the Mode button until blinking blue. 首先让我们将Xenon连接到USB并使它进入聆听模式。 连接后按住“ 模式”按钮直到闪烁蓝色。 Then use the CLI to set up the mesh network. First lets get the device ID: 然后使用CLI设置网状网络。 首先让我们获取设备ID Jareds-MacBook-Pro:nrfjprog.sh jaredwolff$ particle identify ? Which device did you mean?/dev/tty.usbmodem146401 - Argon ❯ /dev/tty.usbmodem146101 - XenonIf you have multiple devices connect, make sure you select the right one! If prompted, select a device. Your output should look something like: 如果有多个设备连接请确保选择正确的设备 如果出现提示请选择设备。 您的输出应类似于 Your device id is e00fce682d9285fbf4412345 Your system firmware version is 1.3.0-rc.1Well need the id for the next step. Now, lets run the particle mesh command. 下一步需要ID 。 现在让我们运行particle mesh命令。 particle mesh add xenon id id of your argon, boron, etcHeres an example below: 下面是一个示例 particle mesh add e00fce682d9285fbf4412345 hamster_turkey ? Enter the network password [hidden] ▄ Adding the device to the network...At the end of it youll see: 在它的结尾您将看到 Done! The device should now connect to the cloud.This process is not perfect. During the Adding the device to the network... stage, I had to remove the Xenon using particle mesh remove. Then re-run the particle mesh add command after resetting the Argon. 这个过程并不完美。 在“ Adding the device to the network...阶段我不得不使用particle mesh remove Adding the device to the network... particle mesh remove氙气。 然后在重置Argon后重新运行particle mesh add命令。 Now here comes to finale. 现在到了结局。 Connect the two devices to serial using particle serial monitor --follow 使用particle serial monitor --follow将两个设备连接到串行- particle serial monitor --follow If you have the two devices connected, particle serial monitor will prompt you to select: 如果您连接了两个设备 particle serial monitor将提示您选择 Jareds-MacBook-Pro:blynk-xenon-rgb jaredwolff$ particle serial monitor --follow Polling for available serial device... ? Which device did you mean? /dev/tty.usbmodem146101 - Xenon Opening serial monitor for com port: /dev/tty.usbmodem146101 Serial monitor opened successfully:Remember: You have to run particle serial monitor for each device you want to connect to. 切记您必须为要连接的每个设备运行particle serial monitor 。 If all is working, youll likely see some output from the edge router! 如果一切正常您可能会看到边缘路由器的一些输出 Serial monitor opened successfully: eventtemperature data21 eventtemperature data28 eventtemperature data21 eventtemperature data27 eventtemperature data28 eventtemperature data26 eventtemperature data23 eventtemperature data26 eventtemperature data21Looking at the app, the Super Chart should be reacting to this new data. 查看该应用程序 超级图表应对此新数据做出React。 Compare the last value in the command line to the last on the chart? Do they match? If so, you made it to the end of this example! 将命令行中的最后一个值与图表中的最后一个进行比较 他们匹配吗 如果是这样那么您就可以完成本示例 结论 (Conclusion) In this tutorial youve learned how to forward Particle Cloud data to Blynk. Youve also learned how to do the same using a Particle Argon, Boron or ethernet connected Xenon. Awe yea. 在本教程中您学习了如何将粒子云数据转发到Blynk。 您还学习了如何使用粒子氩气硼或以太网连接的氙气进行相同的操作。 太好了 Now that you have the tools to Blink-ify your Particle Mesh powered projects, its time to get to work! 现在您已经拥有了对Battery Mesh驱动的项目进行眨眼化处理的工具是时候开始工作了 Like this post? 喜欢这个职位吗 This post is an excerpt from my upcoming Ultimate Guide to Particle Mesh. Ill be sharing more exclusive content with my mailing list as it gets closer to launch. You can sign up here for updates. 这篇文章摘自我即将出版的《粒子网格终极指南》 。 随着邮件列表越来越接近发布我将与我的邮件列表共享更多独家内容。 您可以在此处注册以进行更新。 Still have questions? 还有问题吗 Leave a comment or shoot me a line. 发表评论或给我打个电话。 翻译自: https://www.freecodecamp.org/news/2-best-ways-to-get-particle-mesh-working-with-blynk/粒子网格算法 pm
http://www.sadfv.cn/news/287015/

相关文章:

  • 网站开发用什么数据库网站如何做404
  • 做优秀网站有什么做家常菜的网站
  • 福建中国建设工程造价管理协会网站asp网站显示空白
  • 网站备案 地域深圳建设网站排名
  • 企业网站页面宽哪里设置wordpress 爬虫插件
  • 怎样做网站备份禹州做网站的公司
  • 国外做兼职的网站网站用哪些系统做的比较好
  • 网站子页设计用wordpress建医疗网站
  • 快彩网站开发网站内容管理系统建设
  • app与网站的区别功能自己做的网站能备案
  • 中山网站建设咨询建设银行咸阳交费网站
  • 做网站要用到哪些架包网站定制怎么收费
  • 好玩有趣的网站网上做兼职老师的正规网站
  • 网站建设描述西部数码个人网站
  • 网站开发与推广方向德阳响应式网站建设
  • 四川成都网站建设公司专门做网站的软件是
  • 制作个网站大概多少钱校友网站 建设
  • 广铁建设集团门户网站网络科技有限公司和科技有限公司的区别
  • 网站备案账号是什么情况朝阳网络推广
  • 中国建设住建网站做网站开发学什么内容
  • 如何创立一个网站wordpress 优化提速
  • 网站建设开发技术天津如何建设自己的网站 知乎
  • 怎么建设网站首页镇江模板网站
  • 外贸网站都有那些网站设计业务
  • 网站建设与管理书籍网站机房建设
  • 旅游网站开发选题背景wordpress最新的编辑器
  • 做网站建设 个体经营 小微企业2023年企业所得税最新政策
  • 装饰设计网站模板北京公司注册网址
  • 百度公司做网站吗有哪些好的做兼职网站
  • 康巴什网站建设网站根目录