Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
Fork of TCPEchoClient by
Homepage
Basic program.
It connects to a remote server on a LAN running a Python script. Server send data to a spreadsheet in my google docs account.
PYTHON CODE
PYTHON CODE
#!/usr/bin/python import time import datetime import sys import gspread import socket # Socket port = 50006 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('', port)) s.listen(1) # Google Acoount Details email = 'your-email@gmail.com' password = 'your-password' spreadsheet = 'ldr' # Login with your Google account try: gc = gspread.login(email, password) except: print "unable to login in. Check your email address/password" sys.exit() # Open a worksheet for your spreadsheet using the filename try: wks = gc.open(spreadsheet).sheet1 except: print ("unable to open the spredsheet. Check your filename: %s") % spreadsheet sys.exit() time.sleep(1) input = 0 conn, addr = s.accept() print 'Connected by', addr while True: input = conn.recv(1024) print(input) print(datetime.datetime.now(), input) print('write angle to gdocs') try: values = [datetime.datetime.now(), input] wks.append_row(values) except: print ("Unable to append data. Check your connection?") sys.exit()