<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mouser 10-24-18 PSoC 6 &amp; 4343W WiFi/BLE &#8211; IoT Expert</title>
	<atom:link href="https://iotexpert.com/category/misc/mouser-10-24-18/feed/" rel="self" type="application/rss+xml" />
	<link>https://iotexpert.com</link>
	<description>Engineering for the Internet of Things</description>
	<lastBuildDate>Wed, 24 Oct 2018 01:03:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://iotexpert.com/wp-content/uploads/2017/01/cropped-Avatar-32x32.jpg</url>
	<title>Mouser 10-24-18 PSoC 6 &amp; 4343W WiFi/BLE &#8211; IoT Expert</title>
	<link>https://iotexpert.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Mouser PSoC 6-WiFi-BT L8: Integrate WiFi and AWS Into the Game</title>
		<link>https://iotexpert.com/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/</link>
					<comments>https://iotexpert.com/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:08:53 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5965</guid>

					<description><![CDATA[Summary In this lesson we will move the subscriber app functionality into the main GameBle project (now called GameBleAws).  In order to do this, you need to turn the subscriber into a thread, and fix it so that messages that are sent to the PADDLE topic get turned into messages that can be sent to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>In this lesson we will move the subscriber app functionality into the main GameBle project (now called GameBleAws).  In order to do this, you need to turn the subscriber into a thread, and fix it so that messages that are sent to the PADDLE topic get turned into messages that can be sent to the paddleQueue.</p>
<p>To implement this lesson I will follow these steps:</p>
<ol>
<li>Create a New Project starting from L6GameBle</li>
<li>Copy over subscriber.c and wifi_config_dct.h</li>
<li>Update the Makefile</li>
<li>Create subscriber.h</li>
<li>Update main.c</li>
<li>Update subscriber.c</li>
<li>Test</li>
</ol>
<h1>Create a New Project</h1>
<p>Copy and paste the L6GameBle project into a new project called L8GameBleAws using Copy/Paste</p>
<p><a href="https://iotexpert.com/?attachment_id=6009" rel="attachment wp-att-6009"><img fetchpriority="high" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.02-PM.png" alt="" width="936" height="336" class="alignnone size-full wp-image-6009" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.02-PM.png 936w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.02-PM-600x215.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.02-PM-300x108.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.02-PM-768x276.png 768w" sizes="(max-width: 936px) 100vw, 936px" /></a></p>
<p>Create a new Make target for the GameBleAws project</p>
<p><a href="https://iotexpert.com/?attachment_id=6008" rel="attachment wp-att-6008"><img decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-1.58.35-PM.png" alt="" width="808" height="824" class="alignnone size-full wp-image-6008" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-1.58.35-PM.png 808w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-1.58.35-PM-600x612.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-1.58.35-PM-294x300.png 294w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-1.58.35-PM-768x783.png 768w" sizes="(max-width: 808px) 100vw, 808px" /></a></p>
<h1>Copy subscriber.c &amp; wifi_config_dct.h</h1>
<p>Use copy/paste to make a copy of the subscriber application and paste it into the GameBleAws project.  Once done your folder should look like this:</p>
<p><a href="https://iotexpert.com/?attachment_id=6010" rel="attachment wp-att-6010"><img decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.58-PM.png" alt="" width="384" height="556" class="alignnone size-full wp-image-6010" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.58-PM.png 384w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.01.58-PM-207x300.png 207w" sizes="(max-width: 384px) 100vw, 384px" /></a></p>
<p><a href="https://iotexpert.com/?attachment_id=5969" rel="attachment wp-att-5969"></a></p>
<h1>Update the Makefile</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c">NAME := App_WStudio_L8GameBleAws

$(NAME)_SOURCES := main.c \
    CapSenseThread.c \
	GameThread.c \
	cy_tft_display.c \
	GoBleThread.c \
	GoBle_db.c \
	wiced_bt_cfg.c \
	subscriber.c

$(NAME)_COMPONENTS := graphics/ugui \
                      libraries/drivers/bluetooth/low_energy \
                      protocols/AWS

WIFI_CONFIG_DCT_H := wifi_config_dct.h

$(NAME)_RESOURCES  := apps/aws/iot/rootca.cer \
                      apps/aws/iot/subscriber/client.cer \
                      apps/aws/iot/subscriber/privkey.cer
                      
# To support Low memory platforms, disabling components which are not required
GLOBAL_DEFINES += WICED_CONFIG_DISABLE_SSL_SERVER \
                  WICED_CONFIG_DISABLE_DTLS \
                  WICED_CONFIG_DISABLE_ENTERPRISE_SECURITY \
                  WICED_CONFIG_DISABLE_DES \
                  WICED_CONFIG_DISABLE_ADVANCED_SECURITY_CURVES</pre>
<h1>Create subscriber.h</h1>
<p>In order for the main.c to know about the awsThread (which is the former application_start of subscriber.c) you should create a file called subscriber.h.  Then you should define the awsThread function to match the wiced_thread_t function prototype (just a function that takes a wiced_thread_arg and returns void).</p>
<pre class="lang:c decode:true">#pragma once
extern void awsThread( wiced_thread_arg_t arg );
</pre>
<h1>Update main.c</h1>
<p>To integrate the awsThread thread into your main project you need to add the &#8220;subscriber.h&#8221; to the includes:</p>
<pre class="lang:c decode:true">#include "GameThread.h"
#include "GoBleThread.h"
#include "CapSenseThread.h"
#include "subscriber.h"
#include "wiced.h"
</pre>
<p>Add a new variable to hold the awsThreadHandle.</p>
<pre class="start-line:39 lang:c decode:true ">wiced_thread_t awsThreadHandle;</pre>
<p>Finally you should launch the AWS thread by creating it with wiced_rtos_create_thread.</p>
<pre class="start-line:96 lang:c decode:true ">void application_start( )
{
    wiced_init( );
    wiced_rtos_init_queue(&amp;paddleQueue,"paddleQueue",sizeof(game_msg_t),10);
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
    wiced_rtos_create_thread(&amp;capsenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0);
    wiced_rtos_create_thread(&amp;gameThreadHandle,7,"game Thread",gameThread,4096,0);
    GoBleThread_start();
    wiced_rtos_create_thread(&amp;awsThreadHandle,7,"AWS Thread",awsThread,4096,0);
 }
</pre>
<h1>Update subscriber.c</h1>
<p>In order for subscriber.c to be useful you need to fix the includes, send the messages from the PADDLE topic to the game thread, and turn application_start into a thread.  Start by fixing the includes (just like we did in the BLE Example in Lesson 6)</p>
<pre class="start-line:88 lang:c decode:true">#include "SystemGlobal.h"
#include "GameThread.h"</pre>
<p>When you get a message to the PADDLE topic, you should parse it, then send a message to the game thread to move the paddle.  You do this exactly the same way as you did in the BLE project.  Notice that I protect the game thread by making sure it send a value less than 100.</p>
<pre class="start-line:176 lang:c decode:true">        case WICED_AWS_EVENT_PAYLOAD_RECEIVED:
        {
            uint32_t val;
            WPRINT_APP_INFO( ("[Application/AWS] Payload Received[ Topic: %.*s ]:\n", (int)data-&gt;message.topic_length, data-&gt;message.topic ) );

            if(strncmp(WICED_TOPIC,(const char *)data-&gt;message.topic,strlen(WICED_TOPIC)) == 0 &amp;&amp; data-&gt;message.data_length &lt; 4)
            {
                sscanf((const char *)data-&gt;message.data,"%d",(int *)&amp;val);
                if(val&gt;100)
                    val = 100;

                WPRINT_APP_INFO(("Val = %d\n",(int)val));
                game_msg_t msg;
                msg.evt = MSG_POSITION;
                msg.val = val;
                wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            }
        }
        break;
</pre>
<h1>Test</h1>
<p>I don&#8217;t really have a good program (like the GoBle) to test moving the paddle live.  But you can see that when the game is over, you can still move the paddle using AWS console.  In the screen shot below you can see that I moved the paddle to position 0.  And you can see that the BLE started at the same time as AWS.  Score.</p>
<p><a href="https://iotexpert.com/?attachment_id=5970" rel="attachment wp-att-5970"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-6.55.02-PM.png" alt="" width="837" height="501" class="alignnone size-full wp-image-5970" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-6.55.02-PM.png 837w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-6.55.02-PM-600x359.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-6.55.02-PM-300x180.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-6.55.02-PM-768x460.png 768w" sizes="auto, (max-width: 837px) 100vw, 837px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC 6-WiFi-BT L7 : Implement WiFi and AWS</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:07:00 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5946</guid>

					<description><![CDATA[Summary In this lesson I am going to update one of the predefined application which we deliver as part of WICED Studio which knows how to connect to the AWS IoT Cloud to work on my network.  This will demonstrate WiFi and MQTT.  I will also fix the application so that it knows about a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>In this lesson I am going to update one of the predefined application which we deliver as part of WICED Studio which knows how to connect to the AWS IoT Cloud to work on my network.  This will demonstrate WiFi and MQTT.  I will also fix the application so that it knows about a new MQTT Topic called &#8220;PADDLE&#8221; which will be used to send messages to move the game paddle.</p>
<p>To implement this project I will:</p>
<ol>
<li>Copy the subscriber from demo/aws/iot/pub_sub/subscriber</li>
<li>Setup a &#8220;thing&#8221; on AWS and download the certificates</li>
<li>Update the certificates in the WICED installation</li>
<li>Update the project with my AWS configuration</li>
<li>Test</li>
<li>Update the project to be compatible with the Game</li>
<li>Test</li>
</ol>
<h1>Copy Subscriber &amp; Fix the Makefile</h1>
<p>The first thing that I will do is copy/paste the subscriber application which can be found at demo/aws/iot/pub_sub/subscriber into my folder.  I will also rename the project to L7subscriber. Once that is done it should look like this:</p>
<p><a href="https://iotexpert.com/?attachment_id=6013" rel="attachment wp-att-6013"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.08.29-PM.png" alt="" width="332" height="146" class="alignnone size-full wp-image-6013" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.08.29-PM.png 332w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.08.29-PM-300x132.png 300w" sizes="auto, (max-width: 332px) 100vw, 332px" /></a></p>
<p>Then you need to edit the Makefile to update the name of the project.</p>
<pre class="start-line:37 EnlighterJSRAW" data-enlighter-language="c" ">NAME := App_WStudio_L7subscriber
<a href="https://iotexpert.com/?attachment_id=5975" rel="attachment wp-att-5975"></a></pre>
<h1>Go to Amazon.com and Create a &#8220;thing&#8221;</h1>
<p>In order to connect to the AWS cloud you need to create a &#8220;thing&#8221;.  Go to the AWS console and click &#8220;Create&#8221;</p>
<p><a href="https://iotexpert.com/?attachment_id=5953" rel="attachment wp-att-5953"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM-1024x593.png" alt="" width="1024" height="593" class="alignnone size-large wp-image-5953" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM-1024x593.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM-600x347.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM-300x174.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM-768x445.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.47.55-PM.png 1166w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>We are just going to create one thing.  So, click &#8220;Create a single thing&#8221;</p>
<p><a href="https://iotexpert.com/?attachment_id=5952" rel="attachment wp-att-5952"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM-1024x589.png" alt="" width="1024" height="589" class="alignnone size-large wp-image-5952" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM-1024x589.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM-600x345.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM-300x172.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM-768x441.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.12-PM.png 1164w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Give it a name, in this case Mouser.</p>
<p><a href="https://iotexpert.com/?attachment_id=5951" rel="attachment wp-att-5951"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM-1024x1007.png" alt="" width="1024" height="1007" class="alignnone size-large wp-image-5951" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM-1024x1007.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM-600x590.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM-300x295.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM-768x755.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.48.54-PM.png 1153w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>AWS has device level security which is implemented with RSA certificates for each device.  So,  you need to let AWS create a certificate for you.</p>
<p><a href="https://iotexpert.com/?attachment_id=5950" rel="attachment wp-att-5950"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM-1024x992.png" alt="" width="1024" height="992" class="alignnone size-large wp-image-5950" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM-1024x992.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM-600x581.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM-300x291.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM-768x744.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.13-PM.png 1169w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Once that is done download the device certificate and the two keys.  You need to 100% make sure you do this now, because you wont get another chance. I&#8217;m also going to activate the certificate once I have the certificate and keys.</p>
<p><a href="https://iotexpert.com/?attachment_id=5949" rel="attachment wp-att-5949"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM-1024x665.png" alt="" width="1024" height="665" class="alignnone size-large wp-image-5949" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM-1024x665.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM-600x390.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM-300x195.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM-768x499.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.49.37-PM.png 1165w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now attach a policy to your thing.  I already have the &#8220;ww101_policy&#8221; setup.</p>
<p><a href="https://iotexpert.com/?attachment_id=5948" rel="attachment wp-att-5948"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM-1024x573.png" alt="" width="1024" height="573" class="alignnone size-large wp-image-5948" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM-1024x573.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM-600x336.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM-300x168.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM-768x430.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-3.55.43-PM.png 1165w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The policy looks like this.  Basically, things are wide open.</p>
<p><a href="https://iotexpert.com/?attachment_id=5962" rel="attachment wp-att-5962"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM-1024x943.png" alt="" width="1024" height="943" class="alignnone size-large wp-image-5962" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM-1024x943.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM-600x553.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM-300x276.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM-768x707.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.54.21-PM.png 1062w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>Update the Certificates</h1>
<p>The last thing that you need is the most recent AWS certificate.  WICED expects that you use the RSA2048 bit key.</p>
<p><a href="https://iotexpert.com/?attachment_id=5955" rel="attachment wp-att-5955"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM-1024x526.png" alt="" width="1024" height="526" class="alignnone size-large wp-image-5955" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM-1024x526.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM-600x308.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM-300x154.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM-768x395.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.05.09-PM.png 1282w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now that you have the four security documents., you need to integrate them into your WICED installation.  To do this, change directories to ~/Documents/WICED-Studio-6.2/43xxx_Wi-Fi/resources/apps/aws/iot  Then copy the files, and then make symbolic links.  If you are not on a Mac or Linux then just copy the files and rename them appropriately.</p>
<p><a href="https://iotexpert.com/?attachment_id=5958" rel="attachment wp-att-5958"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.30.16-PM.png" alt="" width="776" height="211" class="alignnone size-full wp-image-5958" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.30.16-PM.png 776w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.30.16-PM-600x163.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.30.16-PM-300x82.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.30.16-PM-768x209.png 768w" sizes="auto, (max-width: 776px) 100vw, 776px" /></a></p>
<h1>Update the Project</h1>
<p>AWS creates a virtual machine and runs an MQTT server on that machine.  You can find out the DNS name of that machine on the settings screen.  Here you can see my endpoint.  You will need to configure the WICED project to talk to your server.</p>
<p><a href="https://iotexpert.com/?attachment_id=5947" rel="attachment wp-att-5947"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM-1024x418.png" alt="" width="1024" height="418" class="alignnone size-large wp-image-5947" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM-1024x418.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM-600x245.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM-300x122.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM-768x314.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.00.34-PM.png 1166w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>You need to change the actual endpoint of your MQTT server in the AWS cloud on line 119</p>
<pre class="start-line:117 EnlighterJSRAW" data-enlighter-language="c"">static wiced_aws_endpoint_info_t my_subscriber_aws_iot_endpoint = {
    .transport           = WICED_AWS_TRANSPORT_MQTT_NATIVE,
    .uri                 = "amk6m51qrxr2u-ats.iot.us-east-1.amazonaws.com",
    .peer_common_name    = NULL,
    .ip_addr             = {0},
    .port                = WICED_AWS_IOT_DEFAULT_MQTT_PORT,
    .root_ca_certificate = NULL,
    .root_ca_length      = 0,
};</pre>
<p>In the file wifi_config_dct.h you will need to change the CLIENT_AP_SSID and CLIENT_AP_PASSPHRASE for your network</p>
<pre class="start-line:60 EnlighterJSRAW" data-enlighter-language="c" ">/* This is the default AP the device will connect to (as a client)*/
#define CLIENT_AP_SSID       "WW101WPA"
#define CLIENT_AP_PASSPHRASE "yourpassword"
#define CLIENT_AP_BSS_TYPE   WICED_BSS_TYPE_INFRASTRUCTURE
#define CLIENT_AP_SECURITY   WICED_SECURITY_WPA2_MIXED_PSK
#define CLIENT_AP_CHANNEL    1
#define CLIENT_AP_BAND       WICED_802_11_BAND_2_4GHZ</pre>
<h1>Test</h1>
<p>In order to test the project you will need to create a make target and program your development kit.</p>
<p><a href="https://iotexpert.com/?attachment_id=6014" rel="attachment wp-att-6014"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.12.13-PM.png" alt="" width="942" height="762" class="alignnone size-full wp-image-6014" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.12.13-PM.png 942w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.12.13-PM-600x485.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.12.13-PM-300x243.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-2.12.13-PM-768x621.png 768w" sizes="auto, (max-width: 942px) 100vw, 942px" /></a></p>
<p>Once that is done you can go to the Amazon.com test console and send MQTT messages to the correct topic.</p>
<p><a href="https://iotexpert.com/?attachment_id=5956" rel="attachment wp-att-5956"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM-1024x825.png" alt="" width="1024" height="825" class="alignnone size-large wp-image-5956" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM-1024x825.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM-600x483.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM-300x242.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM-768x619.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.25.03-PM.png 1354w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Here you can see the project attached to my network.  And successfully received the LIGHT ON message.</p>
<p><a href="https://iotexpert.com/?attachment_id=5957" rel="attachment wp-att-5957"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.26.29-PM.png" alt="" width="839" height="524" class="alignnone size-full wp-image-5957" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.26.29-PM.png 839w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.26.29-PM-600x375.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.26.29-PM-300x187.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.26.29-PM-768x480.png 768w" sizes="auto, (max-width: 839px) 100vw, 839px" /></a></p>
<h1>Update the Project for the Game</h1>
<p>We know that the game doesn&#8217;t care about the LIGHT topic so, let&#8217;s change it to PADDLE.</p>
<pre class="start-line:100 lang:c decode:true">#define WICED_TOPIC                                 "PADDLE"</pre>
<p>And let&#8217;s assume that messages to the paddle topic are ASCII numbers &lt;100.  So, we can parse the message and print it out.  Notice that I used sscanf to parse the message and we all know that is super dangerous.</p>
<pre class="start-line:173 EnlighterJSRAW" data-enlighter-language="c"">        case WICED_AWS_EVENT_PAYLOAD_RECEIVED:
        {
            char buff[10];
            uint32_t val;
            WPRINT_APP_INFO( ("[Application/AWS] Payload Received[ Topic: %.*s ]:\n", (int)data-&gt;message.topic_length, data-&gt;message.topic ) );

            if(strncmp(WICED_TOPIC,data-&gt;message.topic,strlen(WICED_TOPIC)) == 0 &amp;&amp; data-&gt;message.data_length &lt; 4)
            {
                sscanf(data-&gt;message.data,"%d",&amp;val);
                WPRINT_APP_INFO(("Val = %d\n",val));
            }
        }
        break;
</pre>
<h1>Test</h1>
<p>After making those updates let&#8217;s program the whole shooting match again.  Then test by sending some messages to the PADDLE topic.</p>
<p><a href="https://iotexpert.com/?attachment_id=5961" rel="attachment wp-att-5961"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM-1024x941.png" alt="" width="1024" height="941" class="alignnone size-large wp-image-5961" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM-1024x941.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM-600x551.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM-300x276.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM-768x706.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.51.23-PM.png 1181w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>It&#8217;s good.  Things are working.</p>
<p><a href="https://iotexpert.com/?attachment_id=5960" rel="attachment wp-att-5960"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.48.01-PM.png" alt="" width="838" height="700" class="alignnone size-full wp-image-5960" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.48.01-PM.png 838w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.48.01-PM-600x501.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.48.01-PM-300x251.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-4.48.01-PM-768x642.png 768w" sizes="auto, (max-width: 838px) 100vw, 838px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC6-WiFi-BT L6 : Integrate GoBle Bluetooth into the Game</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:06:32 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5930</guid>

					<description><![CDATA[Summary At this point we have a working BLE Remote Control and a working Game.  In this lesson I&#8217;ll merge the two projects together so that the GoBle remote control will be able to control the game paddle.  It will do this by creating messages (just like the CapSense messages) and sending them to the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>At this point we have a working BLE Remote Control and a working Game.  In this lesson I&#8217;ll merge the two projects together so that the GoBle remote control will be able to control the game paddle.  It will do this by creating messages (just like the CapSense messages) and sending them to the Game thread via the paddleQueue.  And it will send &#8220;Button0&#8221; messages when &#8220;Button A&#8221; is pressed.</p>
<p>To implement this lesson I will follow these steps:</p>
<ol>
<li>Copy everything into a new project</li>
<li>Modify the Makefile</li>
<li>Modify main.c</li>
<li>Create a new make target</li>
<li>Test it all to make sure things are still working</li>
<li>Modify GoBleThread.c</li>
<li>Program and Test</li>
</ol>
<h1>Copy L4Game into a new project L6GameBle</h1>
<p>Use &#8220;copy&#8221; and &#8220;paste&#8221; to create a new project, when you paste give it the name &#8220;L6GameBle&#8221; (there is an error in the screenshot)</p>
<p><a href="https://iotexpert.com/?attachment_id=5940" rel="attachment wp-att-5940"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.22.49-PM.png" alt="" width="471" height="168" class="alignnone size-full wp-image-5940" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.22.49-PM.png 471w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.22.49-PM-300x107.png 300w" sizes="auto, (max-width: 471px) 100vw, 471px" /></a></p>
<p>Copy the files GoBle_db.c/h, GoBleThread.c/h, and wiced_bt_cfg.c from the GoBle project into your new GameBle project.  After that is done your project should look like this:</p>
<p><a href="https://iotexpert.com/?attachment_id=5939" rel="attachment wp-att-5939"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.20.59-PM.png" alt="" width="285" height="226" class="alignnone size-full wp-image-5939" /></a></p>
<h1>Modify the Makefile</h1>
<ol>
<li>Change the name of the App to &#8220;App_WStudio_L6GameBle&#8221;</li>
<li>Add the new source files</li>
<li>Add the BLE Library &#8220;libraries/drivers/bluetooth/low_energy&#8221;</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="c">NAME := App_WStudio_L6GameBle

$(NAME)_SOURCES := main.c \
    CapSenseThread.c \
	GameThread.c \
	cy_tft_display.c \
	GoBleThread.c \
	GoBle_db.c \
	wiced_bt_cfg.c

$(NAME)_COMPONENTS := graphics/ugui \
                      libraries/drivers/bluetooth/low_energy
</pre>
<h1>Modify main.c</h1>
<p>Add the include for the GeBleThread.</p>
<pre class="lang:c decode:true">#include "GameThread.h"
#include "GoBleThread.h"
#include "CapSenseThread.h"
#include "wiced.h"</pre>
<p>In the application_start function add a call GoBleThread_start() to get the GoBle thread going</p>
<pre class="start-line:93 EnlighterJSRAW" data-enlighter-language="c"">void application_start( )
{
    wiced_init( );
    wiced_rtos_init_queue(&amp;paddleQueue,"paddleQueue",sizeof(game_msg_t),10);
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
    wiced_rtos_create_thread(&amp;capSenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0);
    wiced_rtos_create_thread(&amp;gameThreadHandle,7,"game Thread",gameThread,4096,0);
    GoBleThread_start();
 }
</pre>
<h1>Create a new make target</h1>
<p><a href="https://iotexpert.com/?attachment_id=5935" rel="attachment wp-att-5935"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.03.56-PM.png" alt="" width="430" height="421" class="alignnone size-full wp-image-5935" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.03.56-PM.png 430w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-20-at-1.03.56-PM-300x294.png 300w" sizes="auto, (max-width: 430px) 100vw, 430px" /></a></p>
<h1>Test it all to make sure things are still working</h1>
<p>Run the make target and make sure that the game still plays and that you can get remote control messages.</p>
<h1>Modify GoBleThread.c</h1>
<p>Add the includes for the GameThread (to get access to the game message structure) and SystemGlobal (to get access to the queue)</p>
<pre class="start-line:8 lang:c decode:true">#include "GameThread.h"
#include "SystemGlobal.h"</pre>
<p>I don&#8217;t need (or want) the button/slider printout information.  So I will delete the old button code from goble_event_handler. (delete this stuff)</p>
<pre class="start-line:137 lang:c decode:true">            WPRINT_APP_INFO(("# Buttons = %d ButtonMask=%02X Slider x=%02X Slider Y=%02X Raw=",(int)numButtons,(unsigned int)buttonMask,(unsigned int)sliderX,(unsigned int)sliderY));

            for(int i=0;i&lt;p_attr_req-&gt;data.write_req.val_len;i++)
            {
                WPRINT_APP_INFO(("%02X ",p_attr_req-&gt;data.write_req.p_val[i]));
            }
            WPRINT_APP_INFO(("\n"));</pre>
<p>Now, update the code to send the slider and button information to the GameThread (via the paddleQueue).  You may have noticed that the slider on GoBle gives you 0-&gt;0xFF and the direction is the inverse from the game we setup.  So, I will scale the value to 100 and invert it so that the controller moves the paddle the right way on line 143.  The message format is exactly the same as what we setup for the CapSense.  This means the CapSense slider works at the same time as the GoBle controller.</p>
<pre class="start-line:127 EnlighterJSRAW" data-enlighter-language="c"">   case GATT_ATTRIBUTE_REQUEST_EVT:

        p_attr_req = &amp;p_event_data-&gt;attribute_request;
        if( p_attr_req-&gt;request_type == GATTS_REQ_TYPE_WRITE  &amp;&amp; p_attr_req-&gt;data.handle == HDLC_GOBLE_SERIALPORTID_VALUE)
        {
            uint32_t numButtons = p_attr_req-&gt;data.write_req.p_val[3];
            uint32_t sliderY = p_attr_req-&gt;data.write_req.p_val[5+numButtons];
            uint32_t sliderX = p_attr_req-&gt;data.write_req.p_val[6+numButtons];
            uint32_t buttonMask = 0x00;
            for(int i=0;i&lt;numButtons;i++)
            {
                buttonMask |= (1&lt;&lt;p_attr_req-&gt;data.write_req.p_val[5+i]);
            }

            game_msg_t msg;
            msg.evt = MSG_POSITION;
            msg.val = 100 - (100*sliderY/255);
            wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            if(buttonMask &amp; 0x10)
            {
                msg.evt = MSG_BUTTON0;
                msg.val = 1;
                wiced_result_t result=wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            }
            status = WICED_BT_GATT_SUCCESS;
        }
        break;
</pre>
<h1>Program and Test</h1>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC6-WiFi-BT L5 : GoBLE &#8211;  BLE Remote Control for the Game</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/#comments</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:05:43 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=6019</guid>

					<description><![CDATA[Summary Although I a like the video game, it is for sure missing something.  That something is IoT.  The first IoT thing that we will do to the game is to add a BLE remote control.  I wanted a pre-done remote control that could be downloaded from the App store.  After looking around a little [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>Although I a like the video game, it is for sure missing something.  That something is IoT.  The first IoT thing that we will do to the game is to add a BLE remote control.  I wanted a pre-done remote control that could be downloaded from the App store.  After looking around a little bit I found GoBle.  I published a detailed article about GoBle <a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/" target="_blank" rel="noopener">here</a>, but I&#8217;ll explain enough to make it work with the game.</p>
<p>Here is a screen shot of what the remote control looks like.  You can see that on the left there is a joystick, and on the right there are some buttons.  My son tells me that this is a classic layout for a remote control.</p>
<p><a href="https://iotexpert.com/2018/10/19/goble-remote-control-wiced-bluetooth-implementation/img_6351/" rel="attachment wp-att-5907"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-1024x576.png" alt="" width="1024" height="576" class="alignnone size-large wp-image-5907" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-1024x576.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-600x338.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-300x169.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6351-768x432.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>This remote control works as a &#8220;Central&#8221; meaning it knows how to connect to Peripherals.  For this lesson we will turn on the CYW4343W and make it be a Bluetooth Peripheral.</p>
<p>To implement this lesson I will follow these steps:</p>
<ol>
<li>Create a folder called &#8220;L5GoBle&#8221;</li>
<li>Create a makefile called L5GoBle.mk</li>
<li>Setup a GATT database by creating GoBle_db.h and GoBle_db.c</li>
<li>Setup wiced_bt_cfg.c</li>
<li>Create GoBleThread.c</li>
<li>Create GoBle.c to startup the GoBleThread</li>
<li>Build, Program and Test</li>
</ol>
<h1>Create a directory called &#8220;L5GoBle&#8221;</h1>
<h1>Create a makefile called L5GoBle.mk</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c">NAME := App_WStudio_L5GoBle

$(NAME)_SOURCES    := GoBle.c \
			          GoBleThread.c \
                      GoBle_db.c \
                      wiced_bt_cfg.c

$(NAME)_INCLUDES   := .

$(NAME)_COMPONENTS += libraries/drivers/bluetooth/low_energy 
</pre>
<h1>Setup a GATT database by creating GoBle_db.h and GoBle_db.c</h1>
<p>Create a file called &#8220;GoBle_db.h&#8221;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">// GoBle_db.h

#ifndef __GATT_DATABASE_H__
#define __GATT_DATABASE_H__

#include "wiced.h"

#define __UUID_GOBLE                                 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xb0, 0xdf, 0x00, 0x00
#define __UUID_GOBLE_SERIALPORTID                    0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xb1, 0xdf, 0x00, 0x00

// ***** Primary Service 'Generic Attribute'
#define HDLS_GENERIC_ATTRIBUTE                       0x0001

// ***** Primary Service 'Generic Access'
#define HDLS_GENERIC_ACCESS                          0x0014
// ----- Characteristic 'Device Name'
#define HDLC_GENERIC_ACCESS_DEVICE_NAME              0x0015
#define HDLC_GENERIC_ACCESS_DEVICE_NAME_VALUE        0x0016
// ----- Characteristic 'Appearance'
#define HDLC_GENERIC_ACCESS_APPEARANCE               0x0017
#define HDLC_GENERIC_ACCESS_APPEARANCE_VALUE         0x0018

// ***** Primary Service 'GoBle'
#define HDLS_GOBLE                                   0x0028
// ----- Characteristic 'SerialPortId'
#define HDLC_GOBLE_SERIALPORTID                      0x0029
#define HDLC_GOBLE_SERIALPORTID_VALUE                0x002A
// ===== Descriptor 'Client Configuration'
#define HDLD_GOBLE_SERIALPORTID_CLIENT_CONFIGURATION 0x002B


// External definitions
extern const uint8_t  gatt_database[];
extern const uint16_t gatt_database_len;
extern uint8_t BT_LOCAL_NAME[];
extern const uint16_t BT_LOCAL_NAME_CAPACITY;

#endif /* __GATT_DATABASE_H__ */
</pre>
<p>Create a file called &#8220;GoBle.c&#8221;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">/*
 * This file has been automatically generated by the WICED 20719-B1 Designer.
 * BLE device's GATT database and device configuration.
 *
 */

// GoBle_db.c

#include "GoBle_db.h"

#include "wiced.h"
#include "wiced_bt_uuid.h"
#include "wiced_bt_gatt.h"

/*************************************************************************************
** GATT server definitions
*************************************************************************************/

const uint8_t gatt_database[] = // Define GATT database
{
    /* Primary Service 'Generic Attribute' */
    PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ATTRIBUTE, UUID_SERVICE_GATT),

    /* Primary Service 'Generic Access' */
    PRIMARY_SERVICE_UUID16 (HDLS_GENERIC_ACCESS, UUID_SERVICE_GAP),

    /* Primary Service 'GoBle' */
    PRIMARY_SERVICE_UUID128 (HDLS_GOBLE, __UUID_GOBLE),

        /* Characteristic 'SerialPortId' */
        CHARACTERISTIC_UUID128_WRITABLE (HDLC_GOBLE_SERIALPORTID, HDLC_GOBLE_SERIALPORTID_VALUE,
            __UUID_GOBLE_SERIALPORTID, LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE_NO_RESPONSE | LEGATTDB_CHAR_PROP_WRITE | LEGATTDB_CHAR_PROP_NOTIFY,
            LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ),

            /* Descriptor 'Client Characteristic Configuration' */
            CHAR_DESCRIPTOR_UUID16_WRITABLE (HDLD_GOBLE_SERIALPORTID_CLIENT_CONFIGURATION,
                UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION, LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ | LEGATTDB_PERM_AUTH_WRITABLE),

};

// Length of the GATT database
const uint16_t gatt_database_len = sizeof(gatt_database);
</pre>
<h1>Setup wiced_bt_cfg.c</h1>
<p>The WICED Bluetooth Configuration file is called &#8220;wiced_bt_config.c&#8221;.  The only change I made from the default is the timeout value of the advertising.  You can copy this directly into your file.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">/*
 * This file has been automatically generated by the WICED 20719-B1 Designer.
 * Device Configuration.
 *
 */

/** wiced_bt_cfg.c
 *
 * Runtime Bluetooth stack configuration parameters
 *
 */

#include "wiced_bt_dev.h"
#include "wiced_bt_ble.h"
#include "wiced_bt_uuid.h"
#include "wiced_bt_gatt.h"
#include "wiced_bt_avrc.h"
#include "wiced_bt_cfg.h"

/* Null-Terminated Local Device Name */
uint8_t BT_LOCAL_NAME[] = { 'G','o','B','l','e','T','e','s','t','\0' };
const uint16_t BT_LOCAL_NAME_CAPACITY = sizeof(BT_LOCAL_NAME);


/*******************************************************************
 * wiced_bt core stack configuration
 ******************************************************************/
const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =
{
    .device_name =                          (uint8_t*)BT_LOCAL_NAME,                                    /**&lt; Local device name (NULL terminated) */
    .device_class =                         {0x00, 0x00, 0x00},                                         /**&lt; Local device class */
    .security_requirement_mask =            BTM_SEC_NONE,                                               /**&lt; Security requirements mask (BTM_SEC_NONE, or combination of BTM_SEC_IN_AUTHENTICATE, BTM_SEC_OUT_AUTHENTICATE, BTM_SEC_ENCRYPT */
    .max_simultaneous_links =               1,                                                          /**&lt; Maximum number of simultaneous links to different devices */

    /* BR/EDR Scan Configuration */
    .br_edr_scan_cfg = {
        .inquiry_scan_type =                BTM_SCAN_TYPE_STANDARD,                                     /**&lt; Inquiry Scan Type (BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED) */
        .inquiry_scan_interval =            0x0000,                                                     /**&lt; Inquiry Scan Interval (0 to use default) */
        .inquiry_scan_window =              0x0000,                                                     /**&lt; Inquiry Scan Window (0 to use default) */

        .page_scan_type =                   BTM_SCAN_TYPE_STANDARD,                                     /**&lt; Page Scan Type (BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED) */
        .page_scan_interval =               0x0000,                                                     /**&lt; Page Scan Interval (0 to use default) */
        .page_scan_window =                 0x0000,                                                     /**&lt; Page Scan Window (0 to use default) */
    },

    /* BLE Scan Settings */
    .ble_scan_cfg = {
        .scan_mode =                        BTM_BLE_SCAN_MODE_PASSIVE,                                  /**&lt; BLE Scan Mode (BTM_BLE_SCAN_MODE_PASSIVE or BTM_BLE_SCAN_MODE_ACTIVE) */

        /* Advertisement Scan Configuration */
        .high_duty_scan_interval =          WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL,               /**&lt; High Duty Scan Interval */
        .high_duty_scan_window =            WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW,                 /**&lt; High Duty Scan Window */
        .high_duty_scan_duration =          5,                                                          /**&lt; High Duty Scan Duration in seconds (0 for infinite) */

        .low_duty_scan_interval =           WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL,                /**&lt; Low Duty Scan Interval */
        .low_duty_scan_window =             WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW,                  /**&lt; Low Duty Scan Window */
        .low_duty_scan_duration =           5,                                                          /**&lt; Low Duty Scan Duration in seconds (0 for infinite) */

        /* Connection Scan Configuration */
        .high_duty_conn_scan_interval =     WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL,          /**&lt; High Duty Connection Cycle Connection Scan Interval */
        .high_duty_conn_scan_window =       WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW,            /**&lt; High Duty Connection Cycle Connection Scan Window */
        .high_duty_conn_duration =          30,                                                         /**&lt; High Duty Connection Cycle Connection Duration in seconds (0 for infinite) */

        .low_duty_conn_scan_interval =      WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL,           /**&lt; Low Duty Connection Cycle Connection Scan Interval */
        .low_duty_conn_scan_window =        WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW,             /**&lt; Low Duty Connection Cycle Connection Scan Window */
        .low_duty_conn_duration =           30,                                                         /**&lt; Low Duty Connection Cycle Connection Duration in seconds (0 for infinite) */

        /* Connection Configuration */
        .conn_min_interval =                WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL,                     /**&lt; Minimum Connection Interval */
        .conn_max_interval =                WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL,                     /**&lt; Maximum Connection Interval */
        .conn_latency =                     WICED_BT_CFG_DEFAULT_CONN_LATENCY,                          /**&lt; Connection Latency */
        .conn_supervision_timeout =         WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT,              /**&lt; Connection Link Supervision Timeout */
    },

    /* BLE Advertisement Settings */
    .ble_advert_cfg = {
        .channel_map =                      BTM_BLE_ADVERT_CHNL_37 |                                    /**&lt; Advertising Channel Map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39) */
                                            BTM_BLE_ADVERT_CHNL_38 |
                                            BTM_BLE_ADVERT_CHNL_39,

        .high_duty_min_interval =           WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MIN_INTERVAL,            /**&lt; High Duty Undirected Connectable Minimum Advertising Interval */
        .high_duty_max_interval =           WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MAX_INTERVAL,            /**&lt; High Duty Undirected Connectable Maximum Advertising Interval */
        .high_duty_duration =               0,                                                         /**&lt; High Duty Undirected Connectable Advertising Duration in seconds (0 for infinite) */

        .low_duty_min_interval =            WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MIN_INTERVAL,             /**&lt; Low Duty Undirected Connectable Minimum Advertising Interval */
        .low_duty_max_interval =            WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MAX_INTERVAL,             /**&lt; Low Duty Undirected Connectable Maximum Advertising Interval */
        .low_duty_duration =                60,                                                         /**&lt; Low Duty Undirected Connectable Advertising Duration in seconds (0 for infinite) */

        .high_duty_directed_min_interval =  WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL,   /**&lt; High Duty Directed Minimum Advertising Interval */
        .high_duty_directed_max_interval =  WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL,   /**&lt; High Duty Directed Maximum Advertising Interval */

        .low_duty_directed_min_interval =   WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL,    /**&lt; Low Duty Directed Minimum Advertising Interval */
        .low_duty_directed_max_interval =   WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL,    /**&lt; Low Duty Directed Maximum Advertising Interval */
        .low_duty_directed_duration =       30,                                                         /**&lt; Low Duty Directed Advertising Duration in seconds (0 for infinite) */

        .high_duty_nonconn_min_interval =   WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL,    /**&lt; High Duty Non-Connectable Minimum Advertising Interval */
        .high_duty_nonconn_max_interval =   WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL,    /**&lt; High Duty Non-Connectable Maximum Advertising Interval */
        .high_duty_nonconn_duration =       30,                                                         /**&lt; High Duty Non-Connectable Advertising Duration in seconds (0 for infinite) */

        .low_duty_nonconn_min_interval =    WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL,     /**&lt; Low Duty Non-Connectable Minimum Advertising Interval */
        .low_duty_nonconn_max_interval =    WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL,     /**&lt; Low Duty Non-Connectable Maximum Advertising Interval */
        .low_duty_nonconn_duration =        0,                                                          /**&lt; Low Duty Non-Connectable Advertising Duration in seconds (0 for infinite) */
    },

    /* GATT Configuration */
    .gatt_cfg = {
        .appearance =                       0x0000,                                                     /**&lt; GATT Appearance */
        .client_max_links =                 1,                                                          /**&lt; Client Config: Maximum number of servers that local client can connect to */
        .server_max_links =                 1,                                                          /**&lt; Server Config: Maximum number of remote client connections allowed by local server */
        .max_attr_len =                     512,                                                        /**&lt; Maximum attribute length; wiced_bt_cfg must have a corresponding buffer pool that can hold this length */
        .max_mtu_size =                     515,                                                        /**&lt; Maximum MTU size for GATT connections, should be between 23 and (max_attr_len + 5) */
    },

    /* RFCOMM Configuration */
    .rfcomm_cfg = {
        .max_links =                        0,                                                          /**&lt; Maximum number of simultaneous connected remote devices */
        .max_ports =                        0,                                                          /**&lt; Maximum Number of simultaneous RFCOMM ports */
    },

    /* Application-Managed L2CAP Protocol Configuration */
    .l2cap_application = {
        .max_links =                        0,                                                          /**&lt; Maximum Number of Application-Managed L2CAP Links (BR/EDR and BLE) */
        .max_psm =                          0,                                                          /**&lt; Maximum Number of Application-Managed BR/EDR PSMs */
        .max_channels =                     0,                                                          /**&lt; Maximum Number of Application-Managed BR/EDR Channels */
        .max_le_psm =                       0,                                                          /**&lt; Maximum Number of Application-Managed LE PSMs */
        .max_le_channels =                  0,                                                          /**&lt; Maximum Number of Application-Managed LE Channels */
        .max_le_l2cap_fixed_channels =      0,                                                          /**&lt; Maximum Number of Application-Managed LE L2CAP Fixed Channnels supported (in addition to mandatory channels 4, 5, and 6 */
    },

    /* Audio/Video Distribution Configuration */
    .avdt_cfg = {
        .max_links =                        0,                                                          /**&lt; Maximum Number of simultaneous Audio/Video links */
        .max_seps =                         0,                                                          /**&lt; Maximum Number of stream end points */
    },

    /* AVRC Configuration */
    .avrc_cfg = {
        .roles =                            0,                                                          /**&lt; Local Roles supported (AVRC_CONN_INITIATOR or AVRC_CONN_ACCEPTOR) */
        .max_links =                        0,                                                          /**&lt; Maximum simultaneous Remote Control links */
    },

    /* LE Address Resolution Database Settings */
    .addr_resolution_db_size =              10,                                                         /**&lt; LE Address Resolution Database Size - Effective only for pre-4.2 controller */
    .max_number_of_buffer_pools =           4,                                                          /**&lt; Maximum number of buffer pools in p_btm_cfg_buf_pools and by wiced_create_pool */
    .rpa_refresh_timeout =                  0,         /**&lt; Interval of random address refreshing - secs */
};

/*******************************************************************
 * wiced_bt_stack buffer pool configuration
 *
 * Configure buffer pools used by the stack
 *
 * Pools must be ordered in increasing buf_size.
 * If a pools runs out of buffers, the next pool will be used.
 ******************************************************************/
const wiced_bt_cfg_buf_pool_t wiced_bt_cfg_buf_pools[WICED_BT_CFG_NUM_BUF_POOLS] =
{
/*  { buf_size, buf_count, }, */
    { 64,       12,        }, /* Small Buffer Pool */
    { 360,      4,         }, /* Medium Buffer Pool (used for HCI &amp; RFCOMM control messages, min recommended size is 360) */
    { 512,      4,         }, /* Large Buffer Pool  (used for HCI ACL messages) */
    { 1024,     2,         }, /* Extra Large Buffer Pool (used for AVDT media packets and miscellaneous; if not needed, set buf_count to 0) */
};
</pre>
<h1>Create GoBleThread.c</h1>
<p>In  order for the GoBleThread to work you need:</p>
<ol>
<li>The includes for the GATT Database and the WICED bluetooth stack.</li>
<li>External References to the GATT Database.</li>
<li>A few function prototypes.</li>
<li>A function called &#8220;GoBleThread_start&#8221; to startup the Bluetooth stack and get things going. This includes providing Bluetooth management and GATT event handler functions.</li>
</ol>
<pre class="lang:c decode:true">#include "GoBle_db.h"
#include "wiced.h"
#include "wiced_bt_ble.h"
#include "wiced_bt_gatt.h"
#include "wiced_bt_stack.h"

/*******************************************************************
 * Variable Definitions
 ******************************************************************/
extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings;
extern const wiced_bt_cfg_buf_pool_t wiced_bt_cfg_buf_pools[WICED_BT_CFG_NUM_BUF_POOLS];

/*******************************************************************
 * Function Prototypes
 ******************************************************************/
static wiced_bt_dev_status_t  goble_management_callback    ( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data );
static void                   goble_set_advertisement_data ( void );
static wiced_bt_gatt_status_t goble_event_handler          ( wiced_bt_gatt_evt_t  event, wiced_bt_gatt_event_data_t *p_event_data );

/*******************************************************************
 * Function Definitions
 ******************************************************************/
void GoBleThread_start(void)
{
    wiced_bt_stack_init(goble_management_callback, &amp;wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools);
}
</pre>
<p>Create a function to setup the advertising data.  The GoBle iOS App looks for Peripherals that are advertising the UUID of the GoBLE Service.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">/* Set Advertisement Data */
void goble_set_advertisement_data( void )
{
    wiced_bt_ble_advert_elem_t adv_elem[3] = { 0 };
    uint8_t adv_flag = BTM_BLE_GENERAL_DISCOVERABLE_FLAG | BTM_BLE_BREDR_NOT_SUPPORTED;
    uint8_t num_elem = 0; 

    /* Advertisement Element for Flags */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_FLAG;
    adv_elem[num_elem].len = sizeof(uint8_t);
    adv_elem[num_elem].p_data = &amp;adv_flag;
    num_elem++;

    uint8_t gobleuuid[] = {__UUID_GOBLE};

    /* Advertisement Element for Name */
    adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE;
    adv_elem[num_elem].len = 16;
    adv_elem[num_elem].p_data = gobleuuid;
    num_elem++;

    /* Set Raw Advertisement Data */
    wiced_bt_ble_set_raw_advertisement_data(num_elem, adv_elem);
}
</pre>
<p>The Bluetooth Management Event Handler needs to take actions when the stack turns on, or one of the pairing events occur.</p>
<pre class="lang:c decode:true">/* Bluetooth Management Event Handler */
wiced_bt_dev_status_t goble_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data )
{
    wiced_bt_dev_status_t status = WICED_BT_SUCCESS;

    switch (event)
    {
    case BTM_ENABLED_EVT:
        goble_set_advertisement_data();
        wiced_bt_gatt_register( goble_event_handler );
        wiced_bt_gatt_db_init( gatt_database, gatt_database_len );
        wiced_bt_start_advertisements(BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL);
        break;

    case BTM_SECURITY_REQUEST_EVT:
        wiced_bt_ble_security_grant(p_event_data-&gt;security_request.bd_addr, WICED_BT_SUCCESS);
        break;

    case BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT:
        p_event_data-&gt;pairing_io_capabilities_ble_request.local_io_cap = BTM_IO_CAPABILITIES_NONE;
        p_event_data-&gt;pairing_io_capabilities_ble_request.oob_data = BTM_OOB_NONE;
        p_event_data-&gt;pairing_io_capabilities_ble_request.auth_req = BTM_LE_AUTH_REQ_NO_BOND;
        break;


    case BTM_USER_CONFIRMATION_REQUEST_EVT: // Just confirm
        wiced_bt_dev_confirm_req_reply( WICED_BT_SUCCESS , p_event_data-&gt;user_confirmation_request.bd_addr);
        break;

    case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT:
        WPRINT_APP_INFO(("Paired linke keys\n"));
        status = WICED_BT_ERROR;
        break;

    case BTM_LOCAL_IDENTITY_KEYS_REQUEST_EVT:
    case BTM_PAIRING_COMPLETE_EVT:
    case BTM_ENCRYPTION_STATUS_EVT:
    case BTM_BLE_ADVERT_STATE_CHANGED_EVT:
    case BTM_LPM_STATE_LOW_POWER:
        break;

    default:
        WPRINT_APP_INFO(("Unhandled Bluetooth Management Event: 0x%x (%d)\n", event, event));
        break;
    }

    return status;
}
</pre>
<p>The GATT Event Handler is called</p>
<ol>
<li>When a connection is made or terminated</li>
<li>When the GoBle app writes to your GATT database.  When that happens we will just printout the value that was written</li>
</ol>
<pre class="lang:c decode:true">/* GATT Event Handler */
wiced_bt_gatt_status_t goble_event_handler( wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t *p_event_data )
{
    wiced_bt_gatt_status_t status = WICED_BT_GATT_ERROR;
    wiced_bt_gatt_attribute_request_t *p_attr_req = NULL;

    switch ( event )
    {
    case GATT_CONNECTION_STATUS_EVT:
        if(!p_event_data-&gt;connection_status.connected)
        {
            WPRINT_APP_INFO(("Disconnected\n"));
            wiced_bt_start_advertisements(BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL);
        }
        else
            WPRINT_APP_INFO(("Connected\n"));
        break;
    case GATT_ATTRIBUTE_REQUEST_EVT:

        p_attr_req = &amp;p_event_data-&gt;attribute_request;
        if( p_attr_req-&gt;request_type == GATTS_REQ_TYPE_WRITE  &amp;&amp; p_attr_req-&gt;data.handle == HDLC_GOBLE_SERIALPORTID_VALUE)
        {
            uint32_t numButtons = p_attr_req-&gt;data.write_req.p_val[3];
            uint32_t sliderY = p_attr_req-&gt;data.write_req.p_val[5+numButtons];
            uint32_t sliderX = p_attr_req-&gt;data.write_req.p_val[6+numButtons];
            uint32_t buttonMask = 0x00;
            for(int i=0;i&lt;numButtons;i++)
            {
                buttonMask |= (1&lt;&lt;p_attr_req-&gt;data.write_req.p_val[5+i]);
            }

            WPRINT_APP_INFO(("# Buttons = %d ButtonMask=%02X Slider x=%02X Slider Y=%02X Raw=",(int)numButtons,(unsigned int)buttonMask,(unsigned int)sliderX,(unsigned int)sliderY));

            for(int i=0;i&lt;p_attr_req-&gt;data.write_req.val_len;i++)
            {
                WPRINT_APP_INFO(("%02X ",p_attr_req-&gt;data.write_req.p_val[i]));
            }
            WPRINT_APP_INFO(("\n"));
            status = WICED_BT_GATT_SUCCESS;
        }
        break;
    default:
        status = WICED_BT_GATT_SUCCESS;
        break;
    }

    return status;
}
</pre>
<h1>Create GoBleThread.h</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#pragma once

extern void GoBleThread_start(void);
</pre>
<h1>Create GoBle.c to startup the GoBleThread</h1>
<pre class="lang:c decode:true ">#include "GoBleThread.h"
#include "wiced.h"


/*******************************************************************
 * Function Definitions
 ******************************************************************/
void application_start(void)
{
    wiced_init();
    GoBleThread_start();

}

</pre>
<h1>Build, Program and Test</h1>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC6-WiFi-BT L4 : The Video Game</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l4-the-video-game/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l4-the-video-game/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:04:40 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=6017</guid>

					<description><![CDATA[Summary In this lesson I&#8217;ll finish the video game thread by adding the graphics etc. to play the game.  In addition I&#8217;ll fix up the CapSense thread so that it is connected to the game via an RTOS queue. There are three main things going on in this game. A state machine for the game [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>In this lesson I&#8217;ll finish the video game thread by adding the graphics etc. to play the game.  In addition I&#8217;ll fix up the CapSense thread so that it is connected to the game via an RTOS queue.</p>
<p>There are three main things going on in this game.</p>
<ol>
<li>A state machine for the game screen (Splash, Start, Running, Over)</li>
<li>A 20ms timer that updates the screen while the game is running (moves the Paddle and the Ball)</li>
<li>A GUI queue where the rest of the system &#8211; CapSense,  Bluetooth and WiFi &#8211; can send Button and Paddle messages.</li>
</ol>
<p>To implement this project I will:</p>
<ol>
<li>Setup the project and makefile by copying L3CapSenseTft</li>
<li>Update gamethread.h to define the GUI queue messages</li>
<li>Fix main.c to create the queue</li>
<li>Create SystemGlobal.h to give the rest of the files access to the gui queue</li>
<li>Updating the CapSenseThread to send GUI messages</li>
<li>Update the includes in GameThread.c</li>
<li>Add some #define macros to define game parameters</li>
<li>Add a State Machine for the game &amp; define some paddle movement methods</li>
<li>Make forward declarations for the thread functions</li>
<li>Create some variables to maintain game state</li>
<li>Add display functions for the score and the speed</li>
<li>Add functions to start and end the game</li>
<li>Add helper functions to calculate the top and bottom of the paddle</li>
<li>Add a function to update and draw the paddle</li>
<li>Add a function to update and draw the ball</li>
<li>Add a function for the game timer to call</li>
<li>Update the main game thread</li>
</ol>
<h1>Setup the project and makefile by copying L3CapSenseTft</h1>
<p>Use copy/paste to copy the L3CapSenseTft project to a new folder name L4Game.   Change the name of the makefile to be L4Game.mk.</p>
<p>Edit the makefile and change the name of the application.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">NAME := App_WStudio_L4Game

$(NAME)_SOURCES := main.c \
    CapSenseThread.c \
	GameThread.c \
	cy_tft_display.c

$(NAME)_COMPONENTS := graphics/ugui
</pre>
<p>Create a make target for this project</p>
<p><a href="https://iotexpert.com/?attachment_id=6080" rel="attachment wp-att-6080"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-6.48.06-AM.png" alt="" width="904" height="726" class="alignnone size-full wp-image-6080" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-6.48.06-AM.png 904w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-6.48.06-AM-600x482.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-6.48.06-AM-300x241.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-6.48.06-AM-768x617.png 768w" sizes="auto, (max-width: 904px) 100vw, 904px" /></a></p>
<h1>Update GameThread.h to Define the GUI Messages</h1>
<p>All of the threads in the system (CapSense, Bluetooth, and WiFi) will control the paddle and the button by sending messages to an RTOS queue.  In gameThread.h we will add a definition of that message.  The message is just a structure with two values &#8211; which GUI element and what value to send.</p>
<pre class="lang:c decode:true">#pragma once
#include "wiced.h"

typedef enum {
    MSG_POSITION,
    MSG_BUTTON0,
    MSG_BUTTON1,
} game_evt_t;

typedef struct {
    game_evt_t evt;
    uint32_t val;
} game_msg_t;

void gameThread(wiced_thread_arg_t arg);
</pre>
<h1>Fix main.c to Create the Queue</h1>
<p>I typically believe that the RTOS primitives should be owned by the main.c.  To do this edit main.c and fix the includes.</p>
<pre class="lang:c decode:true">#include "GameThread.h"
#include "wiced.h"
#include "CapSenseThread.h"
#include "SystemGlobal.h"</pre>
<p>Then define the queue variable &#8220;paddleQueue&#8221; which I should have names &#8220;guiQueue&#8221; but it is way to late to fix it now &#8212; oh well.</p>
<pre class="start-line:31 lang:c decode:true ">/******************************************************
 *               Variable Definitions
 ******************************************************/

wiced_thread_t blinkThreadHandle;
wiced_thread_t capSenseThreadHandle;
wiced_thread_t gameThreadHandle;
wiced_queue_t paddleQueue;
</pre>
<p>Create the queue</p>
<pre class="start-line:55 lang:c decode:true">void application_start( )
{
    wiced_init( );
    wiced_rtos_init_queue(&amp;paddleQueue,"paddleQueue",sizeof(game_msg_t),10);
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
    wiced_rtos_create_thread(&amp;capSenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0);
    wiced_rtos_create_thread(&amp;gameThreadHandle,7,"game Thread",gameThread,4096,0);
 }
</pre>
<h1>Create SystemGlobal.h</h1>
<p>Each of the threads in the system need to have access to the paddleQueue.  In order to do that create a file called SystemGlobal.h and extern the variable to give them that access.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#pragma once

extern wiced_queue_t paddleQueue;
</pre>
<h1>Updating the CapSenseThread to send GUI messages</h1>
<p>Remember that when we setup the CapSenseThread originally, it just printed out the values.  Let&#8217;s fix it so send messages.  So, edit CapSenseThread.c.</p>
<ol>
<li>Add a message variable (line 8)</li>
<li>Fix the button0 and button 1 to make and send RTOS messages (lines 20/21 and 26/27)</li>
<li>Fix the slider to send the position (lines 33-35)</li>
</ol>
<pre class="lang:c decode:true ">#include "wiced.h"
#include "GameThread.h"
#include "SystemGlobal.h"

void capSenseThread(wiced_thread_arg_t arg)
{

    game_msg_t msg;

    CapSense_Start();
    CapSense_ScanAllWidgets();
    while(1)
    {
        if(!CapSense_IsBusy())
        {

            CapSense_ProcessAllWidgets();
            if(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID))
            {
                msg.evt = MSG_BUTTON0;
                wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            }

            if(CapSense_IsWidgetActive(CapSense_BUTTON1_WDGT_ID))
            {
                msg.evt = MSG_BUTTON1;
                wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            }

            uint32_t val = CapSense_GetCentroidPos(CapSense_LINEARSLIDER0_WDGT_ID);
            if(val &lt; 0xFFFF)
            {
                msg.evt = MSG_POSITION;
                msg.val = val;
                wiced_rtos_push_to_queue(&amp;paddleQueue,&amp;msg,0);
            }
            CapSense_ScanAllWidgets();
        }
        wiced_rtos_delay_milliseconds(25); // Poll every 25ms (actual scan time ~8ms)
    }
}
</pre>
<h1>Update the includes in GameThread.c</h1>
<p>Now let&#8217;s fix GameThread.c.  Start by editing the includes to add a new file called &#8220;SystemGlobal.h&#8221; which contains the global variable for the GUI queue.</p>
<pre class="lang:c decode:true">#include "GameThread.h"
#include "cy_tft_display.h"
#include "SystemGlobal.h"
#include "ugui.h"
</pre>
<h1>Add some #define macros in GameThread.c</h1>
<p>There are a number of constants which I use in the game.  In this section I use #define macros to define them.</p>
<pre class="start-line:10 lang:c decode:true">#define UPDATE_SCREEN_TIME (20) // Update the screen every 20ms
#define SPEED (2)
#define SCREEN_X (320)
#define SCREEN_Y (240)
#define TOP_FIELD (21)
#define PD_WIDTH (10)
#define PD_LEN (70)
#define DOTS (3)
#define PADDLE0_COLOR (C_BLUE)
#define BALL_COLOR (C_GREEN)
#define BALL_SIZE (10)</pre>
<h1>Add a State Machine for the Game &amp; Define Paddle Movement</h1>
<p>Open up GameThread.c &#8211; all of the game control functions will go there.</p>
<p>There will be four screens in the game.  A splash screen to display Cypress and Mouser, a Ready Player 1 Screen, the actual game screen and a game over screen.</p>
<p>In addition the paddle can move a little bit at a time (increment) or jump directly to the position (absolute)</p>
<pre class="start-line:33 lang:c decode:true">// States of the game
typedef enum {
    GS_SPLASH,
    GS_START,
    GS_RUNNING,
    GS_OVER
} game_state_t;

// Methods to move the paddle
typedef enum {
    PADDLE_INCREMENT,
    PADDLE_ABSOLUTE
} paddle_update_t;</pre>
<h1>Fix the gameState statemachine</h1>
<p>In the splash screen I need to set the state machine to GS_SPLASH</p>
<pre class="start-line:242 lang:c decode:true">static void displaySplashScreen()
{
    gameState = GS_SPLASH;
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5,22,36,"Cypress");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*2,22,36,"Mouser");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*3,22,36,"PSoC 6");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*4,22,36,"WICED 4343");

    wiced_rtos_delay_milliseconds(2000);
}
</pre>
<p>In the start screen I need to set the state machine to GS_START</p>
<pre class="start-line:262 EnlighterJSRAW" data-enlighter-language="c" ">// Display the Start Screen
static void  displayStartScreen()
{
    gameState = GS_START;
    UG_FillScreen( C_BLACK );
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 -2 - 18 ,22,36,"Ready");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 + 2 + 18 ,22,36,"Player 1");
    displayStartButton();
}
</pre>
<h1>Make Forward Declarations for Functions</h1>
<p>You should define the functions in advance of using them</p>
<pre class="start-line:52 lang:c decode:true">/******************************************************
 *               Static Function Declarations
 ******************************************************/
static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string);
static void displaySplashScreen();
static void displayStartButton();
static void  displayStartScreen();
static void displayScore();
static void displaySpeed();
static void endGame();
static inline uint32_t calcPaddleTop();
static inline uint32_t calcPaddleBottom();
static void updatePaddle(paddle_update_t type);
static void updateBall();
static void updateScreen(void *arg);
</pre>
<h1>Create some variables to maintain game state</h1>
<p>The updateScreenTimer is used while the game is running to call the updateScreen every 20ms.  The rest of the variables are self explanatory.</p>
<pre class="start-line:68 lang:c decode:true">/******************************************************
 *               Variable Definitions
 ******************************************************/
static UG_GUI   gui;
static wiced_timer_t updateScreenTimer;

static uint32_t gameScore;
static game_state_t gameState;

// position of the paddle
static uint32_t paddle0_desire_pos=0;
static uint32_t paddle0_cur_pos=0;

// Position, direction and speed of the ball
static uint32_t ballx,bally;
static int32_t ballXdir, ballYdir;
static uint32_t ballSpeed;
</pre>
<h1>Add Display Functions for the Score &amp; Speed</h1>
<p>These two functions print the speed and score at the top of the screen.</p>
<pre class="start-line:134 EnlighterJSRAW" data-enlighter-language="c"">// This function displays the score
static void displayScore()
{
    char buff[10];
    sprintf(buff,"%2X",(unsigned int)gameScore);
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 75, 0, buff);
}

// This function displays the speed
static void displaySpeed()
{
    char buff[10];
    sprintf(buff,"%2X",(unsigned int)ballSpeed-1);
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 275, 0, buff);
}
</pre>
<h1>Add Function to Start the Game</h1>
<p>When the game needs to start you:</p>
<ol>
<li>Reset the score</li>
<li>Set the paddle position</li>
<li>Move the ball to the middle of the paddle</li>
<li>Set the ball to move to the right and down</li>
<li>Clear the screen, display score and speed</li>
<li>Start the game running</li>
</ol>
<pre class="start-line:153 lang:c decode:true">// This function initializes everything and starts a new game
static void startGame()
{
    gameScore = 0;

    paddle0_desire_pos = 50; // start the game with the paddle moving
    paddle0_cur_pos = 0;

    ballx = PD_WIDTH ;                   // start the ball on the paddle on the right of the screen
    bally  = calcPaddleTop() + PD_LEN/2; // start the ball in the middle of the paddle

    ballSpeed = SPEED;

    ballXdir = ballSpeed;
    ballYdir = ballSpeed;

    UG_FillScreen( C_BLACK );  // clear screen
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 0, 0,  "Score:");
    displayScore();
    UG_PutString(200,0,"Speed:");
    displaySpeed();
    UG_DrawLine(0,20,SCREEN_X,20,C_RED); // red line under text to represent top of play screen

    gameState = GS_RUNNING;
    wiced_rtos_start_timer(&amp;updateScreenTimer); // Timer to update screen
}

</pre>
<h1>Add Function to End the Game</h1>
<p>When the game is over you should:</p>
<ol>
<li>Move the game state to over</li>
<li>Stop the timer</li>
<li>Display game over</li>
<li>Display press button 0 to start</li>
</ol>
<pre class="start-line:181 lang:c decode:true">// Stop the game
static void endGame()
{
    gameState = GS_OVER;
    wiced_rtos_stop_timer(&amp;updateScreenTimer);
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2,22,36,"Game Over");
    displayStartButton();
}
</pre>
<h1>Add Helper Functions to Calculate Paddle Top &amp; Bottom</h1>
<p>There are two places where you need to know the position of the Paddle.  Specifically:</p>
<ol>
<li>To draw the paddle</li>
<li>To figure out if the ball hit the paddle or not.</li>
</ol>
<p>These two functions calculate the pixel position of the top and bottom of the paddle based on it current position</p>
<pre class="lang:c decode:true ">// Figure out the y position of the top of the paddle
static inline uint32_t calcPaddleTop()
{
    return (paddle0_cur_pos)*DOTS+TOP_FIELD;
}

// Figure out the y position of the bottom of the paddle
static inline uint32_t calcPaddleBottom()
{
    return (paddle0_cur_pos)*DOTS+PD_LEN+TOP_FIELD;
}</pre>
<h1>Add a Function to Update &amp; Draw the Paddle</h1>
<p>While the game is running you need the paddle to move.  There are two methods:</p>
<ol>
<li>Absolute just moves the current position immediately to the desired position.</li>
<li>Incremental, which moves the paddle a little bit towards the desired position.</li>
</ol>
<pre class="start-line:204 lang:c decode:true">// Move the paddle either to : PADDLE_INCREMENT the next location or PADDLE_ABSOLUTE - final location
static void updatePaddle(paddle_update_t type)
{
    // If the paddle is where it is supposed to be then just return
    if(paddle0_cur_pos == paddle0_desire_pos)
        return;

    // erase the current paddle
    UG_FillFrame(0,calcPaddleTop(),PD_WIDTH,calcPaddleBottom(),C_BLACK);

    switch (type)
    {

    case PADDLE_INCREMENT:

        if(paddle0_cur_pos &lt; paddle0_desire_pos)
            paddle0_cur_pos += SPEED;
        else
            paddle0_cur_pos -= SPEED;

        // If the paddle is within one move of the final spot, put it there
        if(abs((int)paddle0_cur_pos-(int)paddle0_desire_pos) &lt; SPEED)
            paddle0_cur_pos = paddle0_desire_pos;
        break;

    case PADDLE_ABSOLUTE:
        paddle0_cur_pos = paddle0_desire_pos;
        break;
    }
    // draw the paddle
    UG_FillFrame(0,calcPaddleTop(),PD_WIDTH,calcPaddleBottom(),PADDLE0_COLOR);
}
</pre>
<h1>Add a function to update and draw the ball</h1>
<p>You need a function to:</p>
<ol>
<li>Move the ball</li>
<li>Figure out if it hit the right/left/top/bottom of the screen and do the right thing.</li>
</ol>
<p>When the ball hits one of those surfaces it needs to change direction to either plus or minus.</p>
<p>Every time it hits the paddle the score should increase and possibly speed up.</p>
<p>If it misses the paddle the game is over.</p>
<pre class="start-line:237 EnlighterJSRAW" data-enlighter-language="c" ">// Move the ball to the next location
static void updateBall()
{
    static const uint32_t BallFudgeFactor=3;

    UG_DrawCircle(ballx,bally,BALL_SIZE,C_BLACK);

    ballx += ballXdir;
    bally += ballYdir;

    // Check to see if the ball hit the far right side
    if(ballx &gt; SCREEN_X - BALL_SIZE)
    {

        ballx = SCREEN_X - BALL_SIZE;
        ballXdir = -ballSpeed;
    }

    // check to see if the ball hit the far left side... or the paddle
    if(ballx &lt; (BALL_SIZE + PD_WIDTH + BallFudgeFactor))
    {
        // See if the ball missed the paddle
        if(bally + BALL_SIZE &lt; calcPaddleTop() || bally - BALL_SIZE &gt; calcPaddleBottom())
        {
            endGame();
            //WPRINT_APP_INFO(("Missed Paddle\r\n"));
        }

        gameScore = gameScore + 1;
        displayScore();
        if(gameScore % 3 == 0) // Speed up every three hits
        {
            ballSpeed +=1;
            displaySpeed();
        }

        ballx = BALL_SIZE + PD_WIDTH + BallFudgeFactor;
        ballXdir = +ballSpeed;
    }
    // Check to see if the ball hit the top or bottom
    if(bally &gt; SCREEN_Y - BALL_SIZE) // bottom
    {
        bally = SCREEN_Y - BALL_SIZE;
        ballYdir = -ballSpeed;
    }

    if(bally &lt; TOP_FIELD+BALL_SIZE) // top
    {
        bally = BALL_SIZE+TOP_FIELD;
        ballYdir = +ballSpeed;
    }
    UG_DrawCircle(ballx,bally,BALL_SIZE,BALL_COLOR);
}
</pre>
<h1>Create a Function for the Game Timer</h1>
<p>An RTOS timer runs every 20ms.  That timer needs a function to move the paddle and move the ball.</p>
<pre class="start-line:291 EnlighterJSRAW" data-enlighter-language="c"">// This function is called every UPADTE_SCREEN_TIME milliseconds by the updateScreenTimer
static void updateScreen(void *arg)
{
    updatePaddle(PADDLE_INCREMENT);
    updateBall();
}</pre>
<h1>Update the Main Game Thread</h1>
<p>The main game thread needs to get messages out of the queue and then do the right thing based on the game state.</p>
<pre class="start-line:298 EnlighterJSRAW" data-enlighter-language="c"">// Main game thread
void gameThread(wiced_thread_arg_t arg)
{
    game_msg_t msg;

    Cy_TFT_Init();                                             // Init the TFT
    UG_Init( &amp;gui, Cy_TFT_displayDriver, SCREEN_X, SCREEN_Y ); // Connect the driver

    UG_FillScreen( C_BLACK );   // Clear the screen
    UG_SetBackcolor( C_BLACK );
    UG_SetForecolor( C_WHITE );

    wiced_rtos_init_timer(&amp;updateScreenTimer,UPDATE_SCREEN_TIME,updateScreen,0);
    displaySplashScreen();
    displayStartScreen();

    while(1)
    {
        wiced_rtos_pop_from_queue(&amp;paddleQueue,&amp;msg,WICED_WAIT_FOREVER);
        switch(msg.evt)
        {
        case MSG_POSITION:
            if(gameState == GS_RUNNING)
                paddle0_desire_pos = msg.val/2;
            if(gameState == GS_OVER)
            {
                paddle0_desire_pos = msg.val/2;
                updatePaddle(PADDLE_ABSOLUTE);
            }
            break;

        case MSG_BUTTON0:
            if(gameState == GS_OVER || gameState == GS_START)
                startGame();
            break;
        case MSG_BUTTON1:
            break;
        }
    }
}
</pre>
<h1>Program and Test</h1>
<p>Now that it is all done&#8230; program and test it.</p>
<h1>GameThread.c</h1>
<p>Here is the whole thread is here so you can copy/paste it into your file.</p>
<pre class="lang:c decode:true ">#include "GameThread.h"
#include "cy_tft_display.h"
#include "SystemGlobal.h"
#include "ugui.h"

/******************************************************
 *                      Macros
 ******************************************************/
#define UPDATE_SCREEN_TIME (20) // Update the screen every 20ms
#define SPEED (2)
#define SCREEN_X (320)
#define SCREEN_Y (240)
#define TOP_FIELD (21)
#define PD_WIDTH (10)
#define PD_LEN (70)
#define DOTS (3)
#define PADDLE0_COLOR (C_BLUE)
#define BALL_COLOR (C_GREEN)
#define BALL_SIZE (10)

/******************************************************
 *                    Constants
 ******************************************************/

/******************************************************
 *                   Enumerations
 ******************************************************/

/******************************************************
 *                 Type Definitions
 ******************************************************/
// States of the game
typedef enum {
    GS_SPLASH,
    GS_START,
    GS_RUNNING,
    GS_OVER
} game_state_t;

// Methods to move the paddle
typedef enum {
    PADDLE_INCREMENT,
    PADDLE_ABSOLUTE
} paddle_update_t;

/******************************************************
 *                    Structures
 ******************************************************/


/******************************************************
 *               Static Function Declarations
 ******************************************************/
static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string);
static void displaySplashScreen();
static void displayStartButton();
static void  displayStartScreen();
static void displayScore();
static void displaySpeed();
static void endGame();
static inline uint32_t calcPaddleTop();
static inline uint32_t calcPaddleBottom();
static void updatePaddle(paddle_update_t type);
static void updateBall();
static void updateScreen(void *arg);

/******************************************************
 *               Variable Definitions
 ******************************************************/
static UG_GUI   gui;
static wiced_timer_t updateScreenTimer;

static uint32_t gameScore;
static game_state_t gameState;

// position of the paddle
static uint32_t paddle0_desire_pos=0;
static uint32_t paddle0_cur_pos=0;

// Position, direction and speed of the ball
static uint32_t ballx,bally;
static int32_t ballXdir, ballYdir;
static uint32_t ballSpeed;


/******************************************************
 *               Functions
 ******************************************************/

// ARH Function to put text in the center of a point (UG_PutString does upper left)
static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string)
{
    y = y - fonty/2;
    x = x - (strlen(string)/2)*fontx;
    if(strlen(string)%2)
        x = x - fontx/2;
    UG_PutString(x,y,string);
}


// Display the splash screen
static void displaySplashScreen()
{
    gameState = GS_SPLASH;
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5,22,36,"Cypress");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*2,22,36,"Mouser");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*3,22,36,"PSoC 6");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*4,22,36,"WICED 4343");

    wiced_rtos_delay_milliseconds(2000);
}

// This function displays the start button message
static void displayStartButton()
{
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutStringCenter(SCREEN_X/2 , SCREEN_Y - 30 ,12,22,  "Press B0 To Start");
}

// Display the Start Screen
static void  displayStartScreen()
{
    gameState = GS_START;
    UG_FillScreen( C_BLACK );
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 -2 - 18 ,22,36,"Ready");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 + 2 + 18 ,22,36,"Player 1");
    displayStartButton();
}


// This function displays the score
static void displayScore()
{
    char buff[10];
    sprintf(buff,"%2X",(unsigned int)gameScore);
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 75, 0, buff);
}

// This function displays the speed
static void displaySpeed()
{
    char buff[10];
    sprintf(buff,"%2X",(unsigned int)ballSpeed-1);
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 275, 0, buff);
}


// This function initializes everything and starts a new game
static void startGame()
{
    gameScore = 0;

    paddle0_desire_pos = 50; // start the game with the paddle moving
    paddle0_cur_pos = 0;

    ballx = PD_WIDTH ;                   // start the ball on the paddle on the right of the screen
    bally  = calcPaddleTop() + PD_LEN/2; // start the ball in the middle of the paddle

    ballSpeed = SPEED;

    ballXdir = ballSpeed;
    ballYdir = ballSpeed;

    UG_FillScreen( C_BLACK );  // clear screen
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutString( 0, 0,  "Score:");
    displayScore();
    UG_PutString(200,0,"Speed:");
    displaySpeed();
    UG_DrawLine(0,20,SCREEN_X,20,C_RED); // red line under text to represent top of play screen

    gameState = GS_RUNNING;
    wiced_rtos_start_timer(&amp;updateScreenTimer); // Timer to update screen
}

// Stop the game
static void endGame()
{
    gameState = GS_OVER;
    wiced_rtos_stop_timer(&amp;updateScreenTimer);
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2,22,36,"Game Over");
    displayStartButton();
}


// Figure out the y position of the top of the paddle
static inline uint32_t calcPaddleTop()
{
    return (paddle0_cur_pos)*DOTS+TOP_FIELD;
}

// Figure out the y position of the bottom of the paddle
static inline uint32_t calcPaddleBottom()
{
    return (paddle0_cur_pos)*DOTS+PD_LEN+TOP_FIELD;
}

// Move the paddle either to : PADDLE_INCREMENT the next location or PADDLE_ABSOLUTE - final location
static void updatePaddle(paddle_update_t type)
{
    // If the paddle is where it is supposed to be then just return
    if(paddle0_cur_pos == paddle0_desire_pos)
        return;

    // erase the current paddle
    UG_FillFrame(0,calcPaddleTop(),PD_WIDTH,calcPaddleBottom(),C_BLACK);

    switch (type)
    {

    case PADDLE_INCREMENT:

        if(paddle0_cur_pos &lt; paddle0_desire_pos)
            paddle0_cur_pos += SPEED;
        else
            paddle0_cur_pos -= SPEED;

        // If the paddle is within one move of the final spot, put it there
        if(abs((int)paddle0_cur_pos-(int)paddle0_desire_pos) &lt; SPEED)
            paddle0_cur_pos = paddle0_desire_pos;
        break;

    case PADDLE_ABSOLUTE:
        paddle0_cur_pos = paddle0_desire_pos;
        break;
    }
    // draw the paddle
    UG_FillFrame(0,calcPaddleTop(),PD_WIDTH,calcPaddleBottom(),PADDLE0_COLOR);
}

// Move the ball to the next location
static void updateBall()
{
    static const uint32_t BallFudgeFactor=3;

    UG_DrawCircle(ballx,bally,BALL_SIZE,C_BLACK);

    ballx += ballXdir;
    bally += ballYdir;

    // Check to see if the ball hit the far right side
    if(ballx &gt; SCREEN_X - BALL_SIZE)
    {

        ballx = SCREEN_X - BALL_SIZE;
        ballXdir = -ballSpeed;
    }

    // check to see if the ball hit the far left side... or the paddle
    if(ballx &lt; (BALL_SIZE + PD_WIDTH + BallFudgeFactor))
    {
        // See if the ball missed the paddle
        if(bally + BALL_SIZE &lt; calcPaddleTop() || bally - BALL_SIZE &gt; calcPaddleBottom())
        {
            endGame();
            //WPRINT_APP_INFO(("Missed Paddle\r\n"));
        }

        gameScore = gameScore + 1;
        displayScore();
        if(gameScore % 3 == 0) // Speed up every three hits
        {
            ballSpeed +=1;
            displaySpeed();
        }

        ballx = BALL_SIZE + PD_WIDTH + BallFudgeFactor;
        ballXdir = +ballSpeed;
    }
    // Check to see if the ball hit the top or bottom
    if(bally &gt; SCREEN_Y - BALL_SIZE) // bottom
    {
        bally = SCREEN_Y - BALL_SIZE;
        ballYdir = -ballSpeed;
    }

    if(bally &lt; TOP_FIELD+BALL_SIZE) // top
    {
        bally = BALL_SIZE+TOP_FIELD;
        ballYdir = +ballSpeed;
    }
    UG_DrawCircle(ballx,bally,BALL_SIZE,BALL_COLOR);
}

// This function is called every UPADTE_SCREEN_TIME milliseconds by the updateScreenTimer
static void updateScreen(void *arg)
{
    updatePaddle(PADDLE_INCREMENT);
    updateBall();
}


// Main game thread
void gameThread(wiced_thread_arg_t arg)
{
    game_msg_t msg;

    Cy_TFT_Init();                                             // Init the TFT
    UG_Init( &amp;gui, Cy_TFT_displayDriver, SCREEN_X, SCREEN_Y ); // Connect the driver

    UG_FillScreen( C_BLACK );   // Clear the screen
    UG_SetBackcolor( C_BLACK );
    UG_SetForecolor( C_WHITE );

    wiced_rtos_init_timer(&amp;updateScreenTimer,UPDATE_SCREEN_TIME,updateScreen,0);
    displaySplashScreen();
    displayStartScreen();

    while(1)
    {
        wiced_rtos_pop_from_queue(&amp;paddleQueue,&amp;msg,WICED_WAIT_FOREVER);
        switch(msg.evt)
        {
        case MSG_POSITION:
            if(gameState == GS_RUNNING)
                paddle0_desire_pos = msg.val/2;
            if(gameState == GS_OVER)
            {
                paddle0_desire_pos = msg.val/2;
                updatePaddle(PADDLE_ABSOLUTE);
            }
            break;

        case MSG_BUTTON0:
            if(gameState == GS_OVER || gameState == GS_START)
                startGame();
            break;
        case MSG_BUTTON1:
            break;
        }
    }
}
</pre>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l4-the-video-game/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC 6-WiFi-BT L3: Using the CY8CKIT-028-TFT Shield</title>
		<link>https://iotexpert.com/mouser-vtw-lesson-3-using-the-tft/</link>
					<comments>https://iotexpert.com/mouser-vtw-lesson-3-using-the-tft/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:03:33 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=6029</guid>

					<description><![CDATA[Summary In this lesson we will start making the game.  The first thing that it will need is a display and we will use the CY8CKIT-028-TFT.  In order to talk to the display we will use a library built into WICED called ugui.  That library needs a driver configuration which we will copy of out [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>In this lesson we will start making the game.  The first thing that it will need is a display and we will use the CY8CKIT-028-TFT.  In order to talk to the display we will use a library built into WICED called ugui.  That library needs a driver configuration which we will copy of out the code example we provide.  Finally we will start building a thread called the &#8220;GameThread&#8221; which will actually make up the game.</p>
<ol>
<li>Download CE222494_PSoC6_WICED_WiFi</li>
<li>Copy the L2CapSense into L3CapSenseTft</li>
<li>Copy cy_tft_display.c/h into the project</li>
<li>Make a file GameThread.h</li>
<li>Make a file GameThread.c</li>
<li>Rename L2CapSense.mk to be L3CapSenseTft.mk &amp; Fix</li>
<li>Update main.c</li>
<li>Test</li>
</ol>
<h1>Download CE222494_PSoC6_WICED_WiFi</h1>
<p>If you click on the <a href="http://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit" target="_blank" rel="noopener">CY8CKIT-062-WiFi-BT</a> webpage you will find that there are a bunch of files which are associated with the development kit, including <a href="http://www.cypress.com/file/416491/download" target="_blank" rel="noopener">CY8CKIT-062-WiFi-BT PSoC® 6 WiFi-BT Pioneer Kit Code Examples.zip</a>.</p>
<p><a href="https://iotexpert.com/?attachment_id=6068" rel="attachment wp-att-6068"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM-1024x773.png" alt="" width="1024" height="773" class="alignnone size-large wp-image-6068" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM-1024x773.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM-600x453.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM-300x227.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM-768x580.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.43.31-AM.png 1504w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Download that folder, then copy the directory into your WICED Studio Apps/WStudio folder.</p>
<p><a href="https://iotexpert.com/?attachment_id=6069" rel="attachment wp-att-6069"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.45.47-AM.png" alt="" width="956" height="394" class="alignnone size-full wp-image-6069" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.45.47-AM.png 956w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.45.47-AM-600x247.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.45.47-AM-300x124.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.45.47-AM-768x317.png 768w" sizes="auto, (max-width: 956px) 100vw, 956px" /></a></p>
<p>Once you do that it should look like this:</p>
<p><a href="https://iotexpert.com/?attachment_id=6071" rel="attachment wp-att-6071"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.48.36-AM.png" alt="" width="618" height="486" class="alignnone size-full wp-image-6071" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.48.36-AM.png 618w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.48.36-AM-600x472.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-4.48.36-AM-300x236.png 300w" sizes="auto, (max-width: 618px) 100vw, 618px" /></a></p>
<h1>Copy L3CapSense into L3CapSenseTft</h1>
<p>Now copy/paste the L2CapSense project into a new project called L3CapSenseTft</p>
<h1>Copy cy_tft_display.c/h into the project</h1>
<p>Open up the CE222494 code example directory and copy the two files cy_tft_display.c andcy_tft_display.c which are drivers for the ugui library and then paste them into your new project L3CapSenseTft.</p>
<h1>Make a file GameThread.h</h1>
<p>Create a new file called GamThread.h and a definition of the GameThread which will be used by the main.c to get the game thread going.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#pragma once
#include "wiced.h"

void gameThread(wiced_thread_arg_t arg);
</pre>
<h1>Make a file GameThread.c</h1>
<p>Now create a file called GameThread.c it will have 5 functions.  Here is the whole file to make it simpler to copy and paste, but Ill explain each function one by one</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#include "GameThread.h"

#include "cy_tft_display.h"

#define SCREEN_X (320)
#define SCREEN_Y (240)

static UG_GUI   gui;


// ARH Function to put text in the center of a point (UG_PutString does upper left)
static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string)
{
    y = y - fonty/2;
    x = x - (strlen(string)/2)*fontx;
    if(strlen(string)%2)
        x = x - fontx/2;
    UG_PutString(x,y,string);
}


// Display the splash screen
static void displaySplashScreen()
{
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5,22,36,"Cypress");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*2,22,36,"Mouser");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*3,22,36,"PSoC 6");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*4,22,36,"WICED 4343");

    wiced_rtos_delay_milliseconds(2000);
}

// This function displays the start button message
static void displayStartButton()
{
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutStringCenter(SCREEN_X/2 , SCREEN_Y - 30 ,12,22,  "Press B0 To Start");
}


// Display the Start Screen
static void  displayStartScreen()
{
    UG_FillScreen( C_BLACK );
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 -2 - 18 ,22,36,"Ready");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 + 2 + 18 ,22,36,"Player 1");
    displayStartButton();
}

// Main game thread
void gameThread(wiced_thread_arg_t arg)
{

    Cy_TFT_Init();                                             // Init the TFT
    UG_Init( &amp;gui, Cy_TFT_displayDriver, SCREEN_X, SCREEN_Y ); // Connect the driver

    UG_FillScreen( C_BLACK );   // Clear the screen
    UG_SetBackcolor( C_BLACK );
    UG_SetForecolor( C_WHITE );

    displaySplashScreen();
    displayStartScreen();

    while(1)
    {
        wiced_rtos_delay_milliseconds(1000);
    }
}
</pre>
<p>The main game thread function is: void gameThread(wiced_thread_arg_t arg).  This function</p>
<ol>
<li>Initializes the TFT</li>
<li>Initializes the UGUI library</li>
<li>Clears the screen (by setting it all black)</li>
<li>Sets the colors to draw white on black</li>
<li>Displays the splash screen (which takes 2 seconds)</li>
<li>Displays the start screen</li>
<li>Waits until the end of time</li>
</ol>
<pre class="start-line:53 EnlighterJSRAW" data-enlighter-language="c"">// Main game thread
void gameThread(wiced_thread_arg_t arg)
{

    Cy_TFT_Init();                                             // Init the TFT
    UG_Init( &amp;gui, Cy_TFT_displayDriver, SCREEN_X, SCREEN_Y ); // Connect the driver

    UG_FillScreen( C_BLACK );   // Clear the screen
    UG_SetBackcolor( C_BLACK );
    UG_SetForecolor( C_WHITE );

    displaySplashScreen();
    displayStartScreen();

    while(1)
    {
        wiced_rtos_delay_milliseconds(1000);
    }
}
</pre>
<p>The function displaySplashScreen simply sets the font, then draws 4 text strings, then waits for a few seconds&#8230; then moves on</p>
<pre class="start-line:23 EnlighterJSRAW" data-enlighter-language="c" ">// Display the splash screen
static void displaySplashScreen()
{
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5,22,36,"Cypress");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*2,22,36,"Mouser");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*3,22,36,"PSoC 6");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/5*4,22,36,"WICED 4343");

    wiced_rtos_delay_milliseconds(2000);
}</pre>
<p>The displayStartScreen put the &#8220;Ready Player 1 on the screen&#8221; and then tells the user to press the B0 to start the game.</p>
<pre class="start-line:35 EnlighterJSRAW" data-enlighter-language="c"">// This function displays the start button message
static void displayStartButton()
{
    UG_FontSelect(&amp;FONT_12X20);
    UG_PutStringCenter(SCREEN_X/2 , SCREEN_Y - 30 ,12,22,  "Press B0 To Start");
}


// Display the Start Screen
static void  displayStartScreen()
{
    UG_FillScreen( C_BLACK );
    UG_FontSelect( &amp;FONT_22X36 );
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 -2 - 18 ,22,36,"Ready");
    UG_PutStringCenter(SCREEN_X/2,SCREEN_Y/2 + 2 + 18 ,22,36,"Player 1");
    displayStartButton();
}
</pre>
<p>The U8G_PutString function uses coordinates x and y to set the upper left of the text.  For formatting purposes it is easier for me to think about the middle of the string.  This function just calculates the upper left (x,y) given the middle center (x,y).  To do this you need to also know the (x,y) size of the font.</p>
<p>static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string)</p>
<pre class="start-line:11 EnlighterJSRAW" data-enlighter-language="c"">// ARH Function to put text in the center of a point (UG_PutString does upper left)
static void UG_PutStringCenter(uint32_t x, uint32_t y, uint32_t fontx, uint32_t fonty,char *string)
{
    y = y - fonty/2;
    x = x - (strlen(string)/2)*fontx;
    if(strlen(string)%2)
        x = x - fontx/2;
    UG_PutString(x,y,string);
}</pre>
<h1>Rename L2CapSense.mk to be L3CapSenseTft.mk &amp; Fix</h1>
<p>To make this build we need to modify the makefile to know about the new thread as well as the tft driver.  In addition we need to tell the linker to link with the graphics library.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c">NAME := App_WStudio_L3CapSenseTft

$(NAME)_SOURCES := 	main.c \
				CapSenseThread.c \
				GameThread.c \
				cy_tft_display.c
				
				

$(NAME)_COMPONENTS := graphics/ugui
</pre>
<h1>Update main.c</h1>
<p>In main.c I will:</p>
<ol>
<li>Include the GameThread.h</li>
<li>Add a variable to hold the gameThreadHandle</li>
<li>Then start the gameThread</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="c">#include "wiced.h"
#include "CapSenseThread.h"
#include "GameThread.h"

/******************************************************
 *                      Macros
 ******************************************************/

/******************************************************
 *                    Constants
 ******************************************************/

/******************************************************
 *                   Enumerations
 ******************************************************/

/******************************************************
 *                 Type Definitions
 ******************************************************/

/******************************************************
 *                    Structures
 ******************************************************/


/******************************************************
 *               Static Function Declarations
 ******************************************************/


/******************************************************
 *               Variable Definitions
 ******************************************************/

wiced_thread_t blinkThreadHandle;
wiced_thread_t capSenseThreadHandle;
wiced_thread_t gameThreadHandle;



/******************************************************
 *               Function Definitions
 ******************************************************/
void pdlBlinkThread(wiced_thread_arg_t arg)
{
     while(1)
     {
         Cy_GPIO_Inv(GPIO_PRT0,3);
         wiced_rtos_delay_milliseconds(500);
     }
}

void application_start( )
{
    wiced_init();
    WPRINT_APP_INFO(("Started Application\n"));
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
    wiced_rtos_create_thread(&amp;capSenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0);
    wiced_rtos_create_thread(&amp;gameThreadHandle,7,"game Thread",gameThread,4096,0);


}
</pre>
<h1>Test</h1>
<p>Now it is ready to test.  So create a Make Target, then Build and Program.  Hopefully you are now Ready Player 1.</p>
<p><a href="https://iotexpert.com/?attachment_id=6073" rel="attachment wp-att-6073"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-5.07.20-AM.png" alt="" width="940" height="744" class="alignnone size-full wp-image-6073" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-5.07.20-AM.png 940w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-5.07.20-AM-600x475.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-5.07.20-AM-300x237.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-23-at-5.07.20-AM-768x608.png 768w" sizes="auto, (max-width: 940px) 100vw, 940px" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-vtw-lesson-3-using-the-tft/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC 6-WiFi-BT L2 : WICED Studio &#038; CapSense</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:02:13 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=6027</guid>

					<description><![CDATA[Summary In this lesson we will build your first WICED Studio project (the blinking LED)  and make sure that you can program the development kit.  Then we will update the project to include a thread for managing the CapSense block.  This thread will be carried into the other projects. To implement this lesson I will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>In this lesson we will build your first WICED Studio project (the blinking LED)  and make sure that you can program the development kit.  Then we will update the project to include a thread for managing the CapSense block.  This thread will be carried into the other projects.</p>
<p>To implement this lesson I will follow these steps:</p>
<ol>
<li>Start WICED Studio 6.2</li>
<li>Select 43xxx</li>
<li>Create a folder called L2CapSense</li>
<li>Create main.c and build a blinking LED thread</li>
<li>Create L2CapSense.mk</li>
<li>Create a make target</li>
<li>Build Program and test it</li>
<li>Create CapSenseThread.c</li>
<li>Create CapSenseThread.h</li>
<li>Update main.c</li>
<li>Update the makefile</li>
<li>Build Program and Test</li>
</ol>
<h1>Create the L2CapSense Folder</h1>
<p><a href="https://iotexpert.com/?attachment_id=6053" rel="attachment wp-att-6053"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM-914x1024.png" alt="" width="914" height="1024" class="alignnone size-large wp-image-6053" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM-914x1024.png 914w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM-600x673.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM-268x300.png 268w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM-768x861.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.30.19-AM.png 1042w" sizes="auto, (max-width: 914px) 100vw, 914px" /></a></p>
<h1>Create main.c</h1>
<p>Right click on the folder and create a new file.  Name it L2CapSense</p>
<p><a href="https://iotexpert.com/?attachment_id=6052" rel="attachment wp-att-6052"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM-925x1024.png" alt="" width="925" height="1024" class="alignnone size-large wp-image-6052" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM-925x1024.png 925w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM-600x664.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM-271x300.png 271w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM-768x850.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.32.04-AM.png 1048w" sizes="auto, (max-width: 925px) 100vw, 925px" /></a></p>
<p>Insert the blinking LED code into main.c</p>
<pre class="lang:c decode:true">#include "wiced.h"

/******************************************************
 *                      Macros
 ******************************************************/

/******************************************************
 *                    Constants
 ******************************************************/

/******************************************************
 *                   Enumerations
 ******************************************************/

/******************************************************
 *                 Type Definitions
 ******************************************************/

/******************************************************
 *                    Structures
 ******************************************************/


/******************************************************
 *               Static Function Declarations
 ******************************************************/


/******************************************************
 *               Variable Definitions
 ******************************************************/

wiced_thread_t blinkThreadHandle;

/******************************************************
 *               Function Definitions
 ******************************************************/
void pdlBlinkThread(wiced_thread_arg_t arg)
{
     while(1)
     {
         Cy_GPIO_Inv(GPIO_PRT0,3);
         wiced_rtos_delay_milliseconds(500);
     }
}

void application_start( )
{
    WPRINT_APP_INFO(("Started Application\n"));
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
}</pre>
<h1>Create L2CapSense.mk</h1>
<p>Create a makefile called L2CapSense.mk</p>
<p><a href="https://iotexpert.com/?attachment_id=6050" rel="attachment wp-att-6050"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM-922x1024.png" alt="" width="922" height="1024" class="alignnone size-large wp-image-6050" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM-922x1024.png 922w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM-600x667.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM-270x300.png 270w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM-768x853.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.33.04-AM.png 1046w" sizes="auto, (max-width: 922px) 100vw, 922px" /></a></p>
<p>Put the build information into the L2CapSense.mk</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">NAME := App_WStudio_L2CapSense

$(NAME)_SOURCES := 	main.c
</pre>
<h1>Create a Make Target to run the project</h1>
<p><a href="https://iotexpert.com/?attachment_id=6049" rel="attachment wp-att-6049"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.36.10-AM.png" alt="" width="880" height="768" class="alignnone size-full wp-image-6049" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.36.10-AM.png 880w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.36.10-AM-600x524.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.36.10-AM-300x262.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.36.10-AM-768x670.png 768w" sizes="auto, (max-width: 880px) 100vw, 880px" /></a></p>
<h1>Build and Test the Blinking LED</h1>
<p><a href="https://iotexpert.com/?attachment_id=6057" rel="attachment wp-att-6057"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM-1024x513.png" alt="" width="1024" height="513" class="alignnone size-large wp-image-6057" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM-1024x513.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM-600x301.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM-300x150.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM-768x385.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.16.09-PM.png 1548w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>Create/Edit a File called CapSenseThread.c</h1>
<pre class="lang:c decode:true">#include "wiced.h"

void capSenseThread(wiced_thread_arg_t arg)
{

    CapSense_Start();
    CapSense_ScanAllWidgets();
    while(1)
    {
        if(!CapSense_IsBusy())
        {

            CapSense_ProcessAllWidgets();
            if(CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID))
            {
                WPRINT_APP_INFO(("Button 0 Active\n"));
            }

            if(CapSense_IsWidgetActive(CapSense_BUTTON1_WDGT_ID))
            {
                WPRINT_APP_INFO(("Button 1 Active\n"));
            }

            uint32_t val = CapSense_GetCentroidPos(CapSense_LINEARSLIDER0_WDGT_ID);
            if(val &lt; 0xFFFF)
            {
                WPRINT_APP_INFO(("Slider = %d\n",(int)val));

            }
            CapSense_ScanAllWidgets();
        }
        wiced_rtos_delay_milliseconds(25); // Poll every 25ms (actual scan time ~8ms)
    }
}
</pre>
<h1>Create/Edit a File Called CapSenseThread.h</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">#pragma once
#include "wiced.h"
void capSenseThread(wiced_thread_arg_t arg);
</pre>
<h1>Update main.c</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">#include "wiced.h"
#include "CapSenseThread.h"
</pre>
<p>Add a variable to hold the handle for the capSenseThread at the top of main.c</p>
<pre class="start-line:35 EnlighterJSRAW" data-enlighter-language="c" ">wiced_thread_t capSenseThreadHandle;
</pre>
<p>Update the main function to start the CapSenseThread</p>
<pre class="start-line:49 EnlighterJSRAW" data-enlighter-language="c"">void application_start( )
{
    WPRINT_APP_INFO(("Started Application\n"));
    wiced_rtos_create_thread(&amp;blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0);
    wiced_rtos_create_thread(&amp;capSenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0);

}
</pre>
<h1>Update the L2CapsenseThread.mk</h1>
<pre class="EnlighterJSRAW" data-enlighter-language="c" ">NAME := App_WStudio_L2CapSense

$(NAME)_SOURCES := 	main.c \
				CapSenseThread.c
				
</pre>
<h1>Build, Program and Test the CapSenseThread</h1>
<p><a href="https://iotexpert.com/?attachment_id=6058" rel="attachment wp-att-6058"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM-1024x500.png" alt="" width="1024" height="500" class="alignnone size-large wp-image-6058" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM-1024x500.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM-600x293.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM-300x147.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM-768x375.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-1.33.22-PM.png 1556w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC 6-WiFi-BT L1 : Developer Resources</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l1-developers-resources/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l1-developers-resources/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Wed, 24 Oct 2018 09:01:32 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<category><![CDATA[WIFI]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=6021</guid>

					<description><![CDATA[Summary This is an index of links to all of the PSoC 6 &#38; CYW4343W learning resources.  You can click the links to go the website or see screen captures of the resources. PSoC 6 Product Page WiFi + Bluetooth Combo Product Page PSoC 6 Documentation PSoC 6 Community Wireless Combo Community CY8CKIT-062-BT-WiFi Development Kit [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<h1>Summary</h1>
<p>This is an index of links to all of the PSoC 6 &amp; CYW4343W learning resources.  You can click the links to go the website or see screen captures of the resources.</p>
<ol>
<li><a href="http://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6" target="_blank" rel="noopener">PSoC 6 Product Page</a></li>
<li><a href="http://www.cypress.com/products/wi-fi-bluetooth-combos" target="_blank" rel="noopener">WiFi + Bluetooth Combo Product Page</a></li>
<li><a href="http://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6#tabs-0-bottom_side-5" target="_blank" rel="noopener">PSoC 6 Documentation</a></li>
<li><a href="https://community.cypress.com/community/psoc-6" target="_blank" rel="noopener">PSoC 6 Community</a></li>
<li><a href="https://community.cypress.com/community/wiced-wifi" target="_blank" rel="noopener">Wireless Combo Community</a></li>
<li><a href="http://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit" target="_blank" rel="noopener">CY8CKIT-062-BT-WiFi Development Kit Product Page</a></li>
<li><a href="http://www.cypress.com/file/407731/download" target="_blank" rel="noopener">CY8CKIT-062-BT-WiFi Development Kit Guide</a></li>
<li><a href="http://www.cypress.com/file/385916/download" target="_blank" rel="noopener">PSoC 6 Datasheet</a></li>
<li><a href="http://www.cypress.com/file/298081/download" target="_blank" rel="noopener">CYW4343W Datasheet</a></li>
<li><a href="http://www.cypress.com/file/385621/download" target="_blank" rel="noopener">PSoC 6 Technical Reference Manuals</a></li>
<li><a href="http://www.cypress.com/search/all?f[0]=meta_type%3Atechnical_documents&amp;f[1]=resource_meta_type%3A574&amp;f[2]=field_related_products%3A114026" target="_blank" rel="noopener">PSoC 6 Application Notes</a></li>
<li><a href="http://www.cypress.com/search/all?sort_by=changed&amp;f%5B0%5D=meta_type%3Atechnical_documents&amp;f%5B1%5D=field_related_products%3A121332&amp;f%5B2%5D=resource_meta_type%3A574" target="_blank" rel="noopener">WiFi + Bluetooth Combo Application Notes</a></li>
<li><a href="http://www.cypress.com/documentation/code-examples/psoc-6-mcu-code-examples" target="_blank" rel="noopener">PSoC 6 Code Examples</a></li>
<li><a href="http://www.cypress.com/training/free-online-video-training-and-tutorials-cypress" target="_blank" rel="noopener">Video Tutorials</a></li>
<li><a href="https://community.cypress.com/community/knowledge-base-articles/content?filterID=contentstatus%5Bpublished%5D~category%5Bpsoc-6%5D" target="_blank" rel="noopener">PSoC 6 Knowledge Base</a></li>
<li>Peripheral Driver Library Documentation (Doxygen)</li>
<li>WICED Documentation</li>
</ol>
<h1>PSoC 6 Product Page</h1>
<p>You can find the PSoC 6 Product landing page for PSoC 6 <a href="http://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6" target="_blank" rel="noopener">here</a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM-1024x870.png" alt="" width="1024" height="870" class="alignnone size-large wp-image-4499" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM-1024x870.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM-600x510.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM-300x255.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM-768x652.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.57.54-PM.png 1280w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WiFi + Bluetooth Combo Page</h1>
<p><a href="https://iotexpert.com/?attachment_id=6037" rel="attachment wp-att-6037"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.51.59-AM-1024x783.png" alt="" width="1024" height="783" class="alignnone size-large wp-image-6037" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.51.59-AM-1024x783.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.51.59-AM-600x459.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.51.59-AM-300x229.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.51.59-AM-768x587.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>PSoC 6 Documentation</h1>
<p>On the PSoC 6 Product Landing page there is a documentation tab that has links to all of the current documentation.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM-806x1024.png" alt="" width="806" height="1024" class="alignnone size-large wp-image-4502" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM-806x1024.png 806w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM-600x762.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM-236x300.png 236w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM-768x975.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.16.16-PM.png 834w" sizes="auto, (max-width: 806px) 100vw, 806px" /></a></p>
<h1>PSoC 6 Community</h1>
<p>Cypress has an active development community and forum.  It can be found <a href="https://community.cypress.com/community/psoc-6" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM-1024x876.png" alt="" width="1024" height="876" class="alignnone size-large wp-image-4495" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM-1024x876.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM-600x514.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM-300x257.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM-768x657.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-2.40.56-PM.png 1478w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>Wireless WiFi + Bluetooth Combo Community</h1>
<p><a href="https://iotexpert.com/?attachment_id=6038" rel="attachment wp-att-6038"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.54.42-AM-1024x585.png" alt="" width="1024" height="585" class="alignnone size-large wp-image-6038" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.54.42-AM-1024x585.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.54.42-AM-600x343.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.54.42-AM-300x171.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.54.42-AM-768x438.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>CY8CKIT-062-WiFi-BT Development Kit Web Page</h1>
<p>Every Cypress development kit has a web page that contains all of the information about it, including links to the documentation and store.  The CY8CKIT-062-WiFi-BT kit page is <a href="http://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/?attachment_id=6039" rel="attachment wp-att-6039"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.56.36-AM-1024x694.png" alt="" width="1024" height="694" class="alignnone size-large wp-image-6039" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.56.36-AM-1024x694.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.56.36-AM-600x407.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.56.36-AM-300x203.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.56.36-AM-768x520.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>CY8CKIT-062-WiFi-BT Development Kit Guide</h1>
<p>You can find the development kit guide <a href="http://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/?attachment_id=6040" rel="attachment wp-att-6040"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.58.01-AM-1024x440.png" alt="" width="1024" height="440" class="alignnone size-large wp-image-6040" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.58.01-AM-1024x440.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.58.01-AM-600x258.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.58.01-AM-300x129.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-5.58.01-AM-768x330.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<h1>PSoC 6 Datasheet</h1>
<p>The PSoC 6 Datasheet is available on Cypress.com <a href="http://www.cypress.com/file/385916/download" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/?attachment_id=6041" rel="attachment wp-att-6041"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.00.20-AM-1024x749.png" alt="" width="1024" height="749" class="alignnone size-large wp-image-6041" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.00.20-AM-1024x749.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.00.20-AM-600x439.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.00.20-AM-300x219.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.00.20-AM-768x562.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<h1>CYW4343W Datasheet</h1>
<p>The CYW4343W datasheet can be found <a href="http://www.cypress.com/file/298081/download" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/?attachment_id=6042" rel="attachment wp-att-6042"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM-1024x662.png" alt="" width="1024" height="662" class="alignnone size-large wp-image-6042" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM-1024x662.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM-600x388.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM-300x194.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM-768x497.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-6.02.12-AM.png 1994w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>PSoC 6 Technical Reference Manual</h1>
<p>Each of the PSoC 6 devices has a lengthy discussion of the Technical Resources.  These documents can be found <a href="http://www.cypress.com/file/385621/download" target="_blank" rel="noopener">here</a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM-1024x997.png" alt="" width="1024" height="997" class="alignnone size-large wp-image-4501" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM-1024x997.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM-600x584.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM-300x292.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM-768x748.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.12.57-PM.png 1105w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>PSoC 6 Application Notes</h1>
<p>You can get them all on our website&#8230; here is a link to the filtered list of <a href="http://www.cypress.com/search/all?f[0]=meta_type%3Atechnical_documents&amp;f[1]=resource_meta_type%3A574&amp;f[2]=field_related_products%3A114026" target="_blank" rel="noopener">PSoC 6 Application Notes</a>.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM-1024x917.png" alt="" width="1024" height="917" class="alignnone size-large wp-image-4459" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM-1024x917.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM-600x537.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM-300x269.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM-768x687.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.06.05-PM.png 1363w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The best application note is always the &#8220;Getting Started&#8221;.  In this case it is <a href="http://www.cypress.com/documentation/application-notes/an210781-getting-started-psoc-6-mcu-bluetooth-low-energy-ble?source=search&amp;cat=technical_documents" target="_blank" rel="noopener">AN210781 &#8220;Getting Started with PSoC 6 MCU with Bluetooth Low Energy (BLE) Connectivity&#8221;</a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM-1024x940.png" alt="" width="1024" height="940" class="alignnone size-large wp-image-4460" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM-1024x940.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM-600x551.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM-300x276.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM-768x705.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-12.08.11-PM.png 1421w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WiFi + Bluetooth Combo Application Notes</h1>
<p>Here is a link to all of the <a href="http://www.cypress.com/search/all?sort_by=changed&amp;f%5B0%5D=meta_type%3Atechnical_documents&amp;f%5B1%5D=field_related_products%3A121332&amp;f%5B2%5D=resource_meta_type%3A574" target="_blank" rel="noopener">WiFI Bluetooth Combo Application</a> Notes.</p>
<p><a href="https://iotexpert.com/?attachment_id=6045" rel="attachment wp-att-6045"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.20.58-AM-1024x784.png" alt="" width="1024" height="784" class="alignnone size-large wp-image-6045" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.20.58-AM-1024x784.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.20.58-AM-600x460.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.20.58-AM-300x230.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.20.58-AM-768x588.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>PSoC 6 Code Examples</h1>
<p>You can find all of the PSoC 6 code examples on the <a href="http://www.cypress.com/documentation/code-examples/psoc-6-mcu-code-examples" target="_blank" rel="noopener">web</a>.  In addition they are built into PSoC Creator.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM-1024x770.png" alt="" width="1024" height="770" class="alignnone size-large wp-image-4500" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM-1024x770.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM-600x451.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM-300x226.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM-768x577.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.01.49-PM.png 1342w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Or in PSoC Creator:</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM.png" alt="" width="310" height="310" class="alignnone size-large wp-image-4455" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM.png 310w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM-300x300.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM-100x100.png 100w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.26-AM-150x150.png 150w" sizes="auto, (max-width: 310px) 100vw, 310px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.45-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.45-AM.png" alt="" width="626" height="476" class="alignnone size-large wp-image-4454" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.45-AM.png 626w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.45-AM-600x456.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.55.45-AM-300x228.png 300w" sizes="auto, (max-width: 626px) 100vw, 626px" /></a></p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.56.02-AM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.56.02-AM.png" alt="" width="626" height="477" class="alignnone size-full wp-image-4453" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.56.02-AM.png 626w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.56.02-AM-600x457.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-11.56.02-AM-300x229.png 300w" sizes="auto, (max-width: 626px) 100vw, 626px" /></a></p>
<h1>Videos</h1>
<p>Cypress has made a bunch of videos that take you step by step through an introduction to PSoC 6.  You can find them on the Cypress t<a href="http://www.cypress.com/training/psoc-101-video-tutorial-series-how-use-arm-cortex-m4-based-psoc-6" target="_blank" rel="noopener">raining website.</a></p>
<p><a href="https://iotexpert.com/?attachment_id=6046" rel="attachment wp-att-6046"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.24.27-AM-1024x735.png" alt="" width="1024" height="735" class="alignnone size-large wp-image-6046" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.24.27-AM-1024x735.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.24.27-AM-600x431.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.24.27-AM-300x215.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-22-at-9.24.27-AM-768x551.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>PSoC 6 Knowledge Base</h1>
<p>The Cypress technical support team writes &#8220;Knowledge Base&#8221; articles when there are repeated issues reported by customers.  You can find them <a href="https://community.cypress.com/community/knowledge-base-articles/content?filterID=contentstatus%5Bpublished%5D~category%5Bpsoc-6%5D" target="_blank" rel="noopener">here</a>.</p>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM-1024x819.png" alt="" width="1024" height="819" class="alignnone size-large wp-image-4505" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM-1024x819.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM-600x480.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM-300x240.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM-768x614.png 768w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-03-at-3.50.02-PM.png 1252w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-3.52.32-PM.png"></a></p>
<h1>Peripheral Driver Library Documentation (Doxygen)</h1>
<p>All of the APIs in the PDL are documented in a Doxygen generated HTML document.  You can get there from</p>
<ul>
<li>Help -&gt; Peripheral Driver Library (this link is live only when you have a PSoC 6 project open)</li>
<li>Right click on a component -&gt; Open PDL Documentation</li>
</ul>
<p><a href="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM.png"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM-1024x580.png" alt="" width="1024" height="580" class="alignnone size-large wp-image-4619" srcset="https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM-1024x580.png 1024w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM-600x340.png 600w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM-300x170.png 300w, https://iotexpert.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-06-at-4.01.06-PM-768x435.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l1-developers-resources/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser PSoC 6-WiFi-BT L0 : Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</title>
		<link>https://iotexpert.com/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/</link>
					<comments>https://iotexpert.com/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Tue, 23 Oct 2018 17:05:09 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[WICED]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5983</guid>

					<description><![CDATA[Summary Hello everyone.  This is lesson 0 of a series of 9 lessons about creating applications for the Cypress CY8CKIT-062-WiFi-BLE development kit.  The marketing guys call the class &#8220;Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth&#8221; &#8230; which although a really long name, is a good description of what we are [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>Hello everyone.  This is lesson 0 of a series of 9 lessons about creating applications for the Cypress CY8CKIT-062-WiFi-BLE development kit.  The marketing guys call the class &#8220;Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth&#8221; &#8230; which although a really long name, is a good description of what we are going to do.</p>
<p>What I will do today is take you lesson by lesson through the class and talk about how it all works and what you need to do.  When I built the class it was absolutely my goal to have every button click and line of code described.  That being said,  it is likely that I made some errors.  So, during the class you will be able to send messages to my team who will answer the questions, or ask me and Ill answer live.  If you missed the class, that&#8217;s OK, you will be able to watch it on replay.  In addition if you have a question after the live stream is over, leave a comment here and Ill answer.</p>
<p>I will attempt to go slowly enough for you to follow along, but if I go to fast, don&#8217;t worry you should be able to follow along with the instructions on this website.</p>
<p>Todays virtual workshop is going to go like this.  Every lesson will have this table in it and you will be able to click to the right place.</p>
<p><span><h1>Designing low-power, cloud-connected IoT devices with PSoC® 6 MCU’s and WICED® Wi-Fi/Bluetooth</h1>
<p><div class="table-responsive"><table  style="width:95%; "  class="easy-table easy-table-default " border="1">
<thead>
<tr><th >#</th>
<th >Lesson</th>
</tr>
</thead>
<tbody>
<tr><td >0</td>
<td ><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/">Introduction</a></td>
</tr>

<tr><td >1</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l1-developers-resources/">Developer Resources</a></td>
</tr>

<tr><td >2</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l2-wiced-studio-capsense/">WICED Studio &amp; CapSense</a></td>
</tr>

<tr><td >3</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-3-using-the-tft/">Using the CY8CKIT-028-TFT Shield</a></td>
</tr>

<tr><td >4</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l4-the-video-game/">The Video Game</a></td>
</tr>

<tr><td >5</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l5-goble-ble-remote-control-for-the-game/">GoBle &amp; Bluetooth</a></td>
</tr>

<tr><td >6</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l6-integrate-goble-bluetooth-into-the-game/">Integrate GoBle Bluetooth into the Game</a></td>
</tr>

<tr><td >7</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-psoc6-wifi-bt-l7-implement-wifi-and-aws/">Implement WiFi and AWS</a></td>
</tr>

<tr><td >8</td>
<td ><a href="https://iotexpert.com/2018/10/24/mouser-vtw-lesson-8-integrate-wifi-and-aws-into-the-game/">Integrate WiFi and AWS Into the Game</a></td>
</tr>
</tbody></table></div></p></span></p>
<p>You will need a few things for this class:</p>
<ul>
<li>CY8CKIT-062-WiFi-BT</li>
<li>WICED Studio 6.2</li>
<li>CySmart or LightBlue a BLE</li>
<li>GoBle an iOS Remote Control App</li>
<li>An Amazon AWS IoT Account</li>
<li>A WiFi Access Point connected to the Internet</li>
</ul>
<h1>CY8CKIT-062-WiFi-BT</h1>
<p>All of the projects in this series of lesson will be built to be programmed onto a CY8CKIT-062-WiFi-BT.  You can get the development kit from <a href="https://www.mouser.com/ProductDetail/Cypress-Semiconductor/CY8CKIT-062-WIFI-BT?qs=lYGu3FyN48c6Xy1GM0bmkg%3D%3D" target="_blank" rel="noopener">Mouser</a>.  This development kit has a bunch of cool stuff including</p>
<ul>
<li>PSoC 6 &#8211; The lowest power, most secure MCU for the IoT</li>
<li>CYW4343W &#8211; A WICED WiFi Bluetooth Combo Radio</li>
<li>S25FL512SAGMFI011 &#8211; A Cypress 512Mb Quad SPI Flash</li>
<li>CCG2 &#8211; A Cypress Type C Controller to manage Power</li>
</ul>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/img_6357-2/" rel="attachment wp-att-5988"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6357-2-1024x564.jpg" alt="" width="1024" height="564" class="alignnone size-large wp-image-5988" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6357-2-1024x564.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6357-2-600x331.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6357-2-300x165.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6357-2-768x423.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The CY8CKIT-028-TFT a full color 320&#215;240 TFT display with an ST7789S display controller.<a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/img_6358-2/" rel="attachment wp-att-5989"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6358-2-984x1024.jpg" alt="" width="984" height="1024" class="alignnone size-large wp-image-5989" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6358-2-984x1024.jpg 984w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6358-2-600x625.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6358-2-288x300.jpg 288w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6358-2-768x800.jpg 768w" sizes="auto, (max-width: 984px) 100vw, 984px" /></a></p>
<p>Here is the whole thing together</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/img_6361/" rel="attachment wp-att-5991"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6361-1024x531.jpg" alt="" width="1024" height="531" class="alignnone size-large wp-image-5991" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6361-1024x531.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6361-600x311.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6361-300x155.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6361-768x398.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>WICED Studio 6.2</h1>
<p>This class is build around WICED Studio 6.2, the Cypress IDE built on top of Eclipse.  WICED Studio has all of the tools, examples and SDKs to build projects for the Cypress WICED Bluetooth and WiFi products.  We support Windows, Mac and Linux and you can download it from our community website: <a href="https://community.cypress.com/community/wireless" target="_blank" rel="noopener">https://community.cypress.com/community/wireless</a> (which I hope you have done by now)</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-9-42-30-am/" rel="attachment wp-att-5987"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-9.42.30-AM-1024x624.png" alt="" width="1024" height="624" class="alignnone size-large wp-image-5987" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-9.42.30-AM-1024x624.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-9.42.30-AM-600x365.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-9.42.30-AM-300x183.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-9.42.30-AM-768x468.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>CySmart or LightBlue a BLE</h1>
<p>CySmart is a BLE GATT Browser which you can get from the<a href="https://itunes.apple.com/us/app/cysmart/id928939093?mt=8" target="_blank" rel="noopener"> iOS App store</a> or the <a href="https://play.google.com/store/apps/details?id=com.cypress.cysmart&amp;hl=en_US" target="_blank" rel="noopener">Google Play store</a></p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-10-29-35-am/" rel="attachment wp-att-5995"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM-1024x894.png" alt="" width="1024" height="894" class="alignnone size-large wp-image-5995" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM-1024x894.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM-600x524.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM-300x262.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM-768x671.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.29.35-AM.png 1830w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-10-30-16-am/" rel="attachment wp-att-5994"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM-965x1024.png" alt="" width="965" height="1024" class="alignnone size-large wp-image-5994" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM-965x1024.png 965w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM-600x637.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM-283x300.png 283w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM-768x815.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.30.16-AM.png 1524w" sizes="auto, (max-width: 965px) 100vw, 965px" /></a></p>
<p>&nbsp;</p>
<h1>GoBle an iOS Remote Control App</h1>
<p>GoBle is a Robot Remote Control App which can be downloaded from the <a href="https://itunes.apple.com/us/app/goble-bluetooth-4-0-controller/id950937437?mt=8" target="_blank" rel="noopener">iOS App Store</a>.</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-10-28-30-am/" rel="attachment wp-att-5993"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.28.30-AM-1024x800.png" alt="" width="1024" height="800" class="alignnone size-large wp-image-5993" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.28.30-AM-1024x800.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.28.30-AM-600x469.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.28.30-AM-300x234.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-10.28.30-AM-768x600.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h1>An Amazon AWS IoT Account</h1>
<p>In order to connect Amazon AWS IoT you will need to create an <a href="https://console.aws.amazon.com" target="_blank" rel="noopener">Amazon AWS Account</a>.  It is essentially free to test you simple applications (obviously there are fees if you deploy many devices)</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-11-21-16-am/" rel="attachment wp-att-6001"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM-1024x849.png" alt="" width="1024" height="849" class="alignnone size-large wp-image-6001" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM-1024x849.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM-600x497.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM-300x249.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM-768x637.png 768w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.21.16-AM.png 1930w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>&nbsp;</p>
<p><a href="https://iotexpert.com/2018/10/23/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/screen-shot-2018-10-21-at-11-23-27-am/" rel="attachment wp-att-6000"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.23.27-AM-1024x581.png" alt="" width="1024" height="581" class="alignnone size-large wp-image-6000" srcset="https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.23.27-AM-1024x581.png 1024w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.23.27-AM-600x340.png 600w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.23.27-AM-300x170.png 300w, https://iotexpert.com/wp-content/uploads/2018/10/Screen-Shot-2018-10-21-at-11.23.27-AM-768x436.png 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-psoc6-wifi-bt-l0-designing-low-power-cloud-connected-iot-devices-with-psoc-6-mcus-and-wiced-wi-fi-bluetooth/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mouser Video Training Workshop &#8211; October 24</title>
		<link>https://iotexpert.com/mouser-video-training-workshop-october-24/</link>
					<comments>https://iotexpert.com/mouser-video-training-workshop-october-24/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Fri, 19 Oct 2018 15:14:10 +0000</pubDate>
				<category><![CDATA[4343W]]></category>
		<category><![CDATA[CY8CKIT-062-WiFi-BT]]></category>
		<category><![CDATA[Mouser 10-24-18 PSoC 6 & 4343W WiFi/BLE]]></category>
		<category><![CDATA[PSoC 6]]></category>
		<category><![CDATA[PSoC Creator]]></category>
		<category><![CDATA[WICED]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=5895</guid>

					<description><![CDATA[On October 24, I will be teaching a Mouser video training workshop &#8230; live streaming on the internet.  The workshop will be about PSoC, WICED, WiFi and Bluetooth.  I am going to show PSoC Creator, WICED Studio and Cypress&#8217;s new development tool Modus Toolbox. You can register for the workshop at this link. I am [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>On October 24, I will be teaching a <a href="http://mouser.com" target="_blank" rel="noopener">Mouser</a> video training workshop &#8230; live streaming on the internet.  The workshop will be about PSoC, WICED, WiFi and Bluetooth.  I am going to show PSoC Creator, WICED Studio and Cypress&#8217;s new development tool Modus Toolbox.</p>
<p>You can register for the workshop at this <a href="https://www.electronicdesign.com/webcasts/designing-low-power-cloud-connected-iot-devices-psoc-6-mcu-s-and-wiced-wi-fibluetooth?partnerref=Mouser" target="_blank" rel="noopener">link</a>.</p>
<p>I am going to build the whole class around the <a href="http://www.cypress.com/documentation/development-kitsboards/psoc-6-wifi-bt-pioneer-kit" target="_blank" rel="noopener">CY8CKIT-062-BLE-WiFi</a> Development Kit.  You can get the devlopment kit from <a href="https://www.mouser.com/ProductDetail/Cypress-Semiconductor/CY8CKIT-062-WIFI-BT?qs=lYGu3FyN48c6Xy1GM0bmkg%3D%3D" target="_blank" rel="noopener">Mouser</a>.</p>
<p><a href="https://iotexpert.com/2018/10/19/mouser-video-training-workshop-october-24/img_6353/" rel="attachment wp-att-5899"><img loading="lazy" decoding="async" src="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6353-e1539961924645-1024x768.jpg" alt="" width="1024" height="768" class="alignnone wp-image-5899 size-large" srcset="https://iotexpert.com/wp-content/uploads/2018/10/IMG_6353-e1539961924645-1024x768.jpg 1024w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6353-e1539961924645-600x450.jpg 600w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6353-e1539961924645-300x225.jpg 300w, https://iotexpert.com/wp-content/uploads/2018/10/IMG_6353-e1539961924645-768x576.jpg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Here is the introduction:</p>
<div class="jupiterx-oembed"><iframe loading="lazy" title="Mouser Video Workshop PSoC" width="500" height="281" src="https://www.youtube.com/embed/30NgWBwbu5w?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/mouser-video-training-workshop-october-24/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
