demo of Murata wifi chip as TCP client.

Dependencies:   SNICInterface mbed-rtos mbed

Fork of murataDemo by Austin Blackstone

Intro

this program demonstrates how to use TCP on the Murata Wifi chip. It will connect to a server and send a message, the server will then send a reply. The reply will be printed out to the terminal on the microcontroller.

Instructions

  1. Make sure you have both the wifi device and the computer running the server on the same network / wifi router.
  2. Change the hard coded IP in the microcontroller code to match that of the laptop running the python server.
  3. Run the python2 script below on the computer
  4. Have a console hooked up to the microcontroller and watch as messages are sent back and forth between the server (python) and the client (murata).
  5. Run the microcontroller code on the device.

For ease of use numbers have been appended to the end of the messages being sent back and forth.

Python Server

Please run this python2.7 code on your computer. Make sure to change the IP Address in the microcontroller code to match the IP of your computer.

import socket
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 7))
s.listen(1)
 
x = 0
while True:
    conn, addr = s.accept()
    print 'Connected b'TCP data from server: 'y', addr
    while True:
        # receive data from board
        data = conn.recv(1024)
        
        # check received data
        if not data: 
            break
        
        # print received data 
        print("TCP data from microcontroller: '"+data+"'")
        
        # send data to board with counter to differentiate messages
        conn.sendall("HelloFromPython!: "+str(x)+"\n\r")
        x+=1

    # close the port
    conn.close()

Revisions of main.cpp

Revision Date Message Actions
32:67402fe56150 2015-04-09 Basic TCP Client working with murata wifi chip File  Diff  Annotate
31:c42d189364b4 2015-04-09 Initial rev of murata demo, all API's are used and broken out. File  Diff  Annotate
30:de5a32932408 2015-04-02 got all API's working, need to cleanup File  Diff  Annotate
29:9f08c7152c7a 2015-04-01 got some initial stuff working File  Diff  Annotate
28:174412ff9671 2015-04-01 got documentation working, stripped out extra fluff File  Diff  Annotate
27:6949291ca38d 2014-11-25 Add the definition of serial for debugging output. File  Diff  Annotate
25:39099b3b173f 2014-09-19 It was supported to the FRDM-KL46Z platform. File  Diff  Annotate
24:3d150ff59276 2014-09-12 Default value of SSID and PassPhrase in source code was changed. File  Diff  Annotate
23:39cf9f03b076 2014-07-15 Modified the module name of Copyright. File  Diff  Annotate
22:e567f0d4b05d 2014-07-15 The platform-dependent code was modified to implemented in ifdef.; The process of debug log output was changed to macro.; File  Diff  Annotate
21:25b85cbbdd82 2014-07-15 The pointing out of in-house reviews was modified. File  Diff  Annotate
20:f0c7f5ca7e8a 2014-06-25 Fixed a variable name of pointer type. File  Diff  Annotate
19:4e2900daad59 2014-06-19 Supported a new command format of SNIC UART. File  Diff  Annotate
18:62daece493a9 2014-06-11 Update SNIC xively demo File  Diff  Annotate
17:0bf3c49a83d5 2014-06-11 Update SNIC xively jumpstart-demo File  Diff  Annotate
16:ed9b9c28f860 2014-05-30 Xively demo File  Diff  Annotate
15:abc12b228291 2014-05-27 Adjusted of parameters for Xively demo for using SNIC UART. File  Diff  Annotate
14:6d58d3855feb 2014-05-26 Created demo application for Xively using the SNIC with TypeYD. File  Diff  Annotate
12:27471bb09274 2013-11-08 First prototype File  Diff  Annotate
11:bdf601a405fc 2013-10-14 Improve a few things about the LCD output:; ; * don't output debug logs; * show Xively logo on boot; File  Diff  Annotate
10:86ffba646df1 2013-10-14 Updated all dependencies and fixed issue with mixing C and C++ File  Diff  Annotate
9:c5dc85d192e2 2013-10-14 Add user config header as it's now required File  Diff  Annotate
8:81743e1228a7 2013-10-11 Merged r6 with r7 File  Diff  Annotate
7:0eff5db44b8b 2013-10-11 Update to use latest version of libxively (in sync with git) File  Diff  Annotate
6:9e4f4a8c1829 2013-09-20 Add missing `)` in a comment File  Diff  Annotate
4:e7ca62a11595 2013-06-26 Added temperature datastream and sleep of 15.0 File  Diff  Annotate
3:7ad3f6543b6e 2013-06-26 Added:; - pause to avoid Xively API rate limits; - reading of temperature sensor available on the application board; File  Diff  Annotate
1:0a61d7ab702c 2013-05-13 Indicate that XI_FEED_ID and XI_API_KEY need to be set by the user File  Diff  Annotate
0:efdea27c3b81 2013-05-13 Xively Jumpstart Demo (v1) File  Diff  Annotate