3235 views|3 replies

9702

Posts

24

Resources
The OP
 

CC3200 Modify the sprinkler routine of Out of Box [Copy link]

This post was last edited by littleshrimp on 2019-1-4 17:59 In the sprinkler example provided by the official Out of Box, the image update and the LED flashing of the development board will be out of sync. The reason is that after the switch is turned on, the development board only receives one blink instruction, and then the development board handles the LED flashing by itself. The web page also handles its own. In addition, the delay of the web page is 300ms, and the delay of the development board is 500ms. It would be strange if they can be synchronized. In order to make the example look more comfortable, it is decided to use multiple instructions for synchronous control. When the switch is switched to on, no blink instruction is sent to the development board. Instead, a light-on instruction is sent to CC3200 every time the image is switched on in the timer. When the image is switched to off, a light-off instruction is sent to CC3200, and the modified web code is repeatedly executed.
  1. sprinklerToggle = setInterval(function() { if (spriklerRunning) { if (imageOn) { sprinkler.attr('src',"images/demo-sprinkler-off.jpg"); com.TI.toggleLED('_OFF'); imageOn = false; } else { sprinkler.attr('src',"images/demo-sprinkler-on.jpg"); com.TI.toggleLED('_ON'); imageOn = true; } } }, 300);
复制代码
Code comment for the switch to directly control the LED light
  1. sprinklerSwitch.click(function(){ if (switchBtn.hasClass('on')) { switchBtn.removeClass('on'); // com.TI.toggleLED('_OFF'); spriklerRunning = false; sprinkler.attr('src',"images/demo-sprinkler-off.jpg"); imageOn = false; } else { switchBtn.add Class('on'); // com.TI.toggleLED('_Blink'); spriklerRunning = true; imageOn = true; } });
复制代码
Because the ON and OFF parameters are used, the LED status is controlled by the following two codes in the CC3200 project. In order to achieve better results, the delay needs to be reduced.
  1. //LED Actions if(g_ucLEDStatus == LED_ON) { GPIO_IF_LedOn(MCU_RED_LED_GPIO); osi_Sleep(5); } if(g_ucLEDStatus == LED_OFF) { GPIO_IF_LedOff(MCU_RED_LED_GPIO); osi_Sleep(5); }
复制代码
The effect after modification Basically synchronized. You can see that although the picture is updated before the instruction is sent, the LED status changes first and then the picture is updated. This may be related to the speed at which the browser updates the picture. This is also in line with the logic of powering the pump before spraying water. If you want to modify it more synchronously, you can add a delay before updating the LED. For example:
  1. //LED Actions if(g_ucLEDStatus == LED_ON) { osi_Sleep(20); GPIO_IF_LedOn(MCU_RED_LED_GPIO); osi_Sleep(5); } if(g_ucLEDStatus == LED_OFF) { osi_Sleep(20); GPIO_IF_LedOff(MCU_RED_LED_GPIO); osi_Sleep(5); }
复制代码
The modified html cannot be downloaded through IDE. You need to use CCS Uniflash provided by TI. Open C:\ti\CC3200SDK_1.3.0\cc3200-sdk\example\out_of_box\html\out_of_box.ucf and click program after setting the COM port When downloading, you also need to jump J15 to 100 (flash) Using Uniflash will also burn the IAR compiled file into the following non-HTML code modification can be directly debugged by IAR
This post is from Wireless Connectivity

Latest reply

You are great at doing projects,  Details Published on 2019-1-7 08:44
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 

2618

Posts

0

Resources
2
 
The shrimp is well made. I'll take it.
This post is from Wireless Connectivity

Comments

Thank you for your support  Details Published on 2019-1-5 14:39
 
 
 

9702

Posts

24

Resources
3
 
alan000345 posted on 2019-1-5 14:31 The shrimp is well done. I accepted it.
Thank you for your support
This post is from Wireless Connectivity

Comments

You are great at doing projects.  Details Published on 2019-1-7 08:44
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

2618

Posts

0

Resources
4
 
littleshrimp posted on 2019-1-5 14:39 Thank you for your support
You are great at doing projects,
This post is from Wireless Connectivity
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list