Skip to content

Commit

Permalink
Lots of new sounds and chimes. Some new spells.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Dec 9, 2019
1 parent dfbfafb commit b7d0b29
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
6 changes: 6 additions & 0 deletions bubblesoff.sh
@@ -0,0 +1,6 @@
#!/bin/bash
curl -s "https://theamackers.com/bubbler/set?which=pump&level=1" > /dev/null
curl -s "https://theamackers.com/bubbler/set?which=led&level=.5" > /dev/null
#read -n 1 -p "Process complete. Press Enter to continue."
#curl -s "https://theamackers.com/bubbler/set?which=pump&level=0" > /dev/null
#curl -s "https://theamackers.com/bubbler/set?which=led&level=0" > /dev/null
3 changes: 3 additions & 0 deletions bubbleson.sh
@@ -0,0 +1,3 @@
#!/bin/bash
curl -s "https://theamackers.com/bubbler/set?which=pump&level=0" > /dev/null
curl -s "https://theamackers.com/bubbler/set?which=led&level=0" > /dev/null
45 changes: 31 additions & 14 deletions magicwand.py
Expand Up @@ -38,7 +38,7 @@ def handleDiscovery(self, dev, isNewDev, isNewData):
global found;
if isNewDev:
print "Discovered device", dev.addr
if (dev.addr == 'cb:22:99:ce:97:8f'):
if (dev.addr == 'ef:26:f1:d5:8a:87'):
found = True
elif isNewData:
print "Received new data from", dev.addr
Expand All @@ -54,7 +54,7 @@ def runScanAndSet(state):
peripheral = None;
devices = scanner.scan(3)
try:
peripheral = btle.Peripheral('cb:22:99:ce:97:8f', btle.ADDR_TYPE_RANDOM)
peripheral = btle.Peripheral('ef:26:f1:d5:8a:87', btle.ADDR_TYPE_RANDOM)
if (peripheral == None):
failures += 1;
if (failures < 10):
Expand Down Expand Up @@ -85,7 +85,7 @@ def turnOn(characteristic):
# Set Output
command = bytearray(3);
command[0] = 0x53; #S
command[1] = 0x04;
command[1] = 0x05;
command[2] = 0x01;

print str(command)
Expand All @@ -94,7 +94,7 @@ def turnOn(characteristic):
# Turn on
command = bytearray(3);
command[0] = 0x54; #T
command[1] = 0x04;
command[1] = 0x05;
command[2] = 0x01;

print str(command)
Expand All @@ -104,7 +104,7 @@ def turnOff(characteristic):
# Set Output
command = bytearray(3);
command[0] = 0x53; #S
command[1] = 0x04;
command[1] = 0x05;
command[2] = 0x01;

print str(command)
Expand All @@ -113,7 +113,7 @@ def turnOff(characteristic):
# Turn on
command = bytearray(3);
command[0] = 0x54; #T
command[1] = 0x04;
command[1] = 0x05;
command[2] = 0x00;

print str(command)
Expand Down Expand Up @@ -301,38 +301,55 @@ def FrameReader():
frame_holder = frame
time.sleep(.03);

bubblesSwitch = False;
def Spell(spell):
global bubblesSwitch;
#Invoke IoT (or any other) actions here
if (spell=="center"):
os.system('killall mpg321');
os.system('mpg321 /home/pi/pi_to_potter/reys.mp3 &')
None
elif (spell=="circle"):
os.system('killall mpg321');
print "Playing audio file..."
os.system('mpg321 /home/pi/pi_to_potter/audio.mp3 &')
elif (spell=="eight"):
print "Togging digital logger."
os.system('killall mpg321');
os.system('mpg321 /home/pi/pi_to_potter/tinkle.mp3 &')
digitalLogger.toggle();
None
elif (spell=="left"):
print "Toggling magic crystal."
t = Thread(target=toggleBLE);
t.do_run = True
t.start()
toggleBLE();
None
elif (spell=="square"):
print "Toggling 'other' pin."
otherpin.toggle();
None
None
elif (spell=="swish"):
None
elif (spell=="tee"):
print "Togging bubbles."
bubblesSwitch = not bubblesSwitch;
os.system('killall mpg321');
os.system('mpg321 /home/pi/pi_to_potter/spellshot.mp3 &')
if (bubblesSwitch):
os.system('/home/pi/pi_to_potter/bubbleson.sh');
else:
os.system('/home/pi/pi_to_potter/bubblesoff.sh');
None
elif (spell=="triangle"):
print "Toggling outlet."
URL = "http://localhost:3000/device/t";
r = requests.get(url = URL);
print "Playing audio file..."
os.system('killall mpg321');
os.system('mpg321 /home/pi/pi_to_potter/wonder.mp3 &')
#URL = "http://localhost:3000/device/t";
#r = requests.get(url = URL);
elif (spell=="zee"):
print "Toggling 'other' pin."
otherpin.toggle();
print "Playing audio file..."
os.system('killall mpg321');
os.system('mpg321 /home/pi/pi_to_potter/zoo.mp3 &')
None
print "CAST: %s" %spell

Expand Down
Binary file added reys.mp3
Binary file not shown.
Binary file added spellshot.mp3
Binary file not shown.
Binary file added tinkle.mp3
Binary file not shown.
Binary file added wonder.mp3
Binary file not shown.
Binary file added zoo.mp3
Binary file not shown.

0 comments on commit b7d0b29

Please sign in to comment.