Skip to content

Commit

Permalink
now exits script after discover if in discovery mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmpercussion committed Jan 9, 2018
1 parent a9ef2a0 commit e842300
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions myo_to_osc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import math
import logging
import argparse
import sys
from pythonosc import osc_message_builder
from pythonosc import udp_client

Expand Down Expand Up @@ -87,8 +88,11 @@ def proc_battery(battery_level):
m.add_imu_handler(proc_imu)
m.add_battery_handler(proc_battery)

if args.discover: # Discovers Myos and prints addresses.
discover_myos(m.bt)
if args.discover: # Discovers Myos and prints addresses, then exits script.
results = discover_myos(m.bt)
if not results:
print("No Myos found.")
sys.exit()

m.connect(address=args.address) # connects to specific Myo unless arg.address is none.
# Setup Myo mode, buzzes when ready.
Expand Down

0 comments on commit e842300

Please sign in to comment.