# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import time import meccano # Connect to the server # For connection you must provide the mac-address of your network adapter, # The server and port where the meccano gateway is running if not meccano.setup("66:66:66:66:66:66", "meccano.server.iot.", 80): print "Could not connect to Meccano Network" exit() # Sending a test fact fact = meccano.fact_create("teste_yun", 1, 10) meccano.fact_send(fact, meccano.MODE_PERSISTENT) # Receiving and processing messages from gateway while (True): custom_messages = meccano.messages_process(30000) if len(custom_messages) > 0: if "MY_COMMAND" in custom_messages: print "Execute my command!" print "Custom commands received: " print custom_messages
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import time import meccano # Connect to the server # For connection you must provide the mac-address of your network adapter, # The server and port where the meccano gateway is running if not meccano.setup("66:66:66:66:66:66", "meccano.server.iot.", 80): print "Could not connect to Meccano Network" exit() # Sending a test fact fact = meccano.fact_create("teste_yun", 1, 10) meccano.fact_send(fact, meccano.MODE_PERSISTENT) # Receiving and processing messages from gateway while(True): custom_messages = meccano.messages_process(30000) if len(custom_messages) > 0: if "MY_COMMAND" in custom_messages: print "Execute my command!" print "Custom commands received: " print custom_messages
# along with this program. If not, see <http://www.gnu.org/licenses/>. # import time import meccano import cv2 MY_ID = "66:66:66:66:66:66" MECCANO_SERVER_ADDRESS = "localhost" MECCANO_SERVER_PORT = 3000 # Connect to the server # For connection you must provide the mac-address of your network adapter, # The server and port where the meccano gateway is running if not meccano.setup(MY_ID, MECCANO_SERVER_ADDRESS, MECCANO_SERVER_PORT): print "Could not connect to Meccano Network" exit() # Create the haar cascade object for face detection faceCascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml") cv2.namedWindow("preview") vc = cv2.VideoCapture(0) infinite = True # Set a new checkpoint (3) meccano.checkpoint(3) while infinite: infinite, frame = vc.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)