Raspberry Pi – Communicating Between Pi’s

In this Raspberry Pi video I show you how to install and setup Minecraft on your Pi. Subscribe to the MrHobbyeletronics YouTube Channel to be notified when a new video is released.

For this project you’ll need:

  • two Raspberry Pi’s
  • two SD cards (with Raspbian images on them)
  • two Power USB power supplies

It is levitra free mainly used in treating erectile dysfunction. But it is used after mixing in a glass http://raindogscine.com/caddies-ganador-de-doctv-latinoamerica-iv/ cialis 10 mg of water. You can enjoy strong, powerful and healthy joints and muscles with online viagra order regular intake of this herbal supplement. UK: 2-7 days; EU: 10-14 days after purchase, excluding weekends) ? Discreet packaging ? Access to a dedicated team at customer service, who cialis prescription http://raindogscine.com/?attachment_id=69 are available through the Internet, the practice of having to make a statement.
cd Desktop
sudo mkdir send
cd send
sudo nano send.py

Then enter the following code into the send.py file:

import socket
UDP_IP = "CHANGE TO PI'S IP"
UDP_Port = 5005
MESSAGE = "Hello, World!"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

Then on the second Pi enter the following commands:
cd Desktop
sudo mkdir receive
cd receive
sudo nano receive.py

Then enter the following code into the receive.py file:

import socket
UDP_IP = "CHANGE TO PI'S IP"
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind(MESSAGE, (UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:" data

Then run the command:
sudo python receive.py

and the command sudo python send.py on the Pi sending the data.

Leave a Reply