Wireless LAN Application Guide

From Flowcode Help
Revision as of 14:28, 3 September 2014 by LeighM (talk | contribs)
Jump to navigationJump to search

Introduction

These examples demonstrate the use of the Flowcode Wireless LAN component.

In particular they make use of the EB069 E-blocks Wireless LAN board and EB006 E-blocks PICmicro multiprogrammer fitted with a 16F1937 microprocessor.

However, the examples are easily changed in Flowcode to support other microprocessors and platforms.

The Matrix TSL EB868SI6 Easy Wireless LAN bundle has all the items required for these sample applications and is an ideal introduction to Wireless internet technology.


Setting up the project hardware

Connect the E-Blocks as indicated in the table below. All the downstream E-Blocks, apart from the LED board, need to be powered via wire connections to the +V on EB006 upstream processor board.


Hardware Setup
EB006 PICmicro multiprogrammer
Port A EB090 E-blocks Sensor board
Port B EB005 E-blocks LCD board
Port C EB069 E-blocks WiFi board
Port D EB004 E-blocks LED board


Example 1: Using the Wireless LAN as a web page server

FC6 Icon.png Wireless Web Server Example

Example 1 demonstrates the use of the WLAN component as a web server. The server is initialised and then the program enters a infinite loop where the value of the Light sensor on the Sensor E-block is read into a variable. The CheckForPageRequests macro function is be called as part of the main program loop as this allows remote page requests to be detected and serviced.

Use the compile to chip button in Flowcode to send the program to the device on the EB006 board. The initialisation will take approximately 30 seconds before the message “WLAN Started” appears on the LCD.

Once this has happened you can connect your laptop or wireless enabled computer to the module. You do this by clicking the wireless icon on the taskbar and you should then be presented with a list of wireless devices including one named Flowcode. Click the Flowcode wireless device to continue.

Clicking the Flowcode network opens up a warning saying the network is unsecured. This is ok so next click the connect button.

Once you have successfully connected your computer to the wireless network you can then access the configuration utility. To do this type in the IP address of the module into your web browser’s address bar. Here the address should be 192.168.0.2

WLAN login.png

If the computer is connected to the network correctly and the program has initialised the module correctly then you will be presented with a login screen as shown above. Use the word admin for the username and password and click ok.


Once you have logged into the configuration utility you can then view the settings for the wireless device and do things like enable security settings to encrypt the wireless network.

WLAN settings.png

To view the pages served from the embedded system you need to use the same IP address but this time you need to specify the server port that was detailed in the Flowcode WLAN component properties. The example port is 5000 so the IP address to connect to the system would look like this. 192.168.0.2:5000

Each time you access a page served from the embedded system the LCD will be updated with the page number of the requested page.

In this example you must manually refresh the page to allow the sensor value from the Light sensor on the sensor E-block to be re-sampled and updated.


Example 2: Enhancing the web page functionality

FC6 Icon.png Page Feature Example

Example 2 is very similar to Example 1 but this time we use javascript code to automatically refresh the page allowing us to see the Light sensor reading. As well as the page refreshing automatically we will use javascript to colour code the sensor reading to provide a more user friendly interface and to demonstrate how javascript variables work.


Example 3: Using request parameters as control commands

FC6 Icon.png Get Request Parameters Example

Example 3 uses the program from example 2 but adds more HTML pages and links to navigate between the pages. In addition this example shows how to use the page request parameters to transfer values from the webpage through to the LEDs on the E-block. Replacing the LEDs with relays or transistors would allow you to control other electronic equipment such as lighting or heating for home automation.