3

My project is to use the Raspberry Pi to send data taken from the "micromouse" to the PC.

The micromouse will run in the maze, and then data will be sent to the Raspberry Pi most likely through the serial port to pin 8 & 10 of the GPIO pins. Then that data will be sent to a PC via wirelessly.

How do I send the data via wireless from the Raspberry Pi to the PC, and how do I know that the data is stored in the Raspberry Pi?

syb0rg
  • 8,178
  • 4
  • 38
  • 51
Jane Alvord
  • 61
  • 2
  • 3
  • 4

2 Answers2

5

If both Raspberry Pi and the PC are inside the same Network then you can send data to the PC using a web server,

Start by setting up a simple server based on web.py, which is installed via apt-get

sudo apt-get install python-webpy

Now create a directory to put the code in and create a simple test program

mkdir webpy
cd webpy
nano server.py

Now let's write a test code. write this inside server.py (make sure you are in a root mode)

#!/usr/bin/python
import web

urls = (
    '/', 'index'
)

class index:
    def GET(self):
        return "Hello, world!"

if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()

Save it and then set it as executable with

chmod +x server.py 

and then run the code

./server.py

you will see something like this showing the server is waiting for a request (pressing Ctrl+C will stop the server)

http://0.0.0.0:8080/

Now from your PC, point your browser at http://ip-address-of-your-pi:8080 and it will show a web page with the content of Hello, world!.

If everything works as intended, you are all good to Go. Replace the content of server.py with the data you need to communicate from Raspberry Pi to the PC.

From your pc, you can read the data using urllib library of Python (the code below is for python 2.x)

import urllib
link = "http://192.168.1.65:8080" # Change this address to your settings
f = urllib.urlopen(link)
myfile = f.read()
date = myfile.split(" ")

You now have the data from your Raspberry Pi into your PC.

Sufiyan Ghori
  • 433
  • 9
  • 18
0

EWD.js could be a possible solution:

ewdGateway2 includes an entirely WebSocket-based framework known as EWD.js.

enter image description here

https://github.com/robtweed/ewdGateway2

Full Documentation

http://gradvs1.mgateway.com/download/EWDjsMechanics.pdf

Mapperz
  • 226
  • 5
  • 11