Posts

Showing posts from October, 2018

Radios

Image
We have decided to use XBee Wireless Shields, as they are cheap and seem to have adequate documentation for use with Arduinos. Thus, we set about finding how we would implement them. We found this webpage , which gave us an introduction to using the XBees, and it didn't take long for the radio to start transmitting. The code for the outlets is as follows: import socket import sys import time # read message to be sent message = raw_input("Enter your message:") # create a UDP socket with server's IP & port number server_address = ('172.18.0.10', 6001) while True: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # Send data print (sys.stderr, 'sending "%s"' % message) # Print the message to be sent. sent = sock.sendto(message.encode('utf-8'), server_address) #Send the message # Receive response print (sys.stderr, 'waiting to receive') #Listen for acknowl