Пример #1
0
def listen(publisher_thread
           ):  # The listen() method takes the publisher thread as a parameter
    print(listener_thread_name + " is Listening!")  # Print Starting Listening!
    global publisher_state  # Set publisher state as a global variable
    publisher_state = True  # Set publisher state to true
    global button_clicked
    if not publisher_thread.is_alive(
    ):  # If publisher thread is not running execute the following code
        publisher_thread.start()  # Start publisher thread
    for dweet in dweepy.listen_for_dweets_from(
            thingTwoName
    ):  # For loop listens for dweets from a specific thing called GrahamThingTwo
        content = dweet[
            "content"]  # Store the content from each dweet into a variable called content
        print(str(content))  # Print content
        try:
            button_clicked = content["ButtonClicked"]
        except:
            print("Button not clicked yet!")
        thing = dweet[
            "thing"]  # Store the thing from each dweet into a variable called thing
        print("Reading from " + str(thing) + ": " + str(content))
        print("")  # Adds an empty line in the terminal below our output above

        try:
            if int(button_clicked
                   ) == 1:  # Check if the button has been pressed
                brightness = 255  # Set maximum brightness
                grovepi.analogWrite(led, brightness)  # Give PWM output to LED
            else:
                brightness = 0  # Set minimum brightness
                grovepi.analogWrite(led, brightness)  # Give PWM output to LED
        except:
            print("Button still not clicked yet!")
    print("Listening Ending!")  # Print Listening Ending!
Пример #2
0
def listener(publisher):
    print("==READY==")

    for dweet in dweepy.listen_for_dweets_from(
            'Lawlor'):  #listens for extracts content from dweets
        content = dweet["content"]
        input = content["input"]
        type = content["type"]

        #start publisher thread (by default will sample but not publish to dweet.io)
        if not publisher.is_alive():
            publisher = Thread(target=publisher_method_dan)
            publisher.start()

        if type == "publish":
            if input == "true":
                #updateSensors(LED_state)
                # start publishing
                global publisher_state
                publisher_state = True
            else:
                publisher_state = False
                print "wasn't true"
        elif type == "sample":  #modify sample rate
            global sampleRate
            sampleRate = int(input)
        else:
            updateSensors(type, input)
Пример #3
0
def listenerLED(publisherLED):
    print("LED Thread Ready"
          )  # Printing this to show that the program has been started
    for dweet in dweepy.listen_for_dweets_from(
            'mypicontrolboardLED'
    ):  # Looping through mypicontrolboardLED Dweet Thing
        content = dweet[
            "content"]  # Assigning value from content on Dweet to variable content
        ledStatus = content[
            "LEDStatus"]  # Assigning value from LEDStatus on Dweet to variable ledStatus
        LEDbrightness = content[
            "LightLevel"]  # Assigning value from LightLevel on Dweet to variable LEDBrightness
        print ledStatus
        if ledStatus == "true":  # If value is true then we run the code block below
            # start the publisher thread
            global publisher_state_for_led
            publisher_state_for_led = True
            global lightBrightness  # Creating a variable lightBrightness that will store the value of LEDbrightness
            lightBrightness = LEDbrightness
            if not publisherLED.is_alive():
                publisherLED = Thread(target=led_publisher_method)
            publisherLED.start()
        else:
            publisher_state_for_led = False
            print "wasn't true"
            grovepi.analogWrite(
                led, 0 / 4
            )  # if the script crashes we can just press the off button and the sensors will turn off.
Пример #4
0
def listenerBuzzer(publisherBuzzer):
    print("Buzzer + Dweet Sensor Reading Ready"
          )  # Printing this to show that the program has been started
    for dweet in dweepy.listen_for_dweets_from(
            'mypicontrolboardBuzzer'
    ):  # Looping through mypicontrolboardBuzzer Dweet Thing
        content = dweet[
            "content"]  # Assigning value from content on Dweet to variable content
        buzzerStatus = content[
            "BuzzerStatus"]  # Assigning value from BuzzerStatus on Dweet to buzzerStatus content
        sample = content[
            "SampleRate"]  # Assigning value from SampleRate on Dweet to variable sample
        print buzzerStatus
        if buzzerStatus == "true":  # If value is true then we run the code block below
            # start the publisher thread
            global publisher_state_buzzer
            publisher_state_buzzer = True
            global sampleRate  # Creating this to store sample value in sampleRate
            sampleRate = sample
            if not publisherBuzzer.is_alive():
                publisherBuzzer = Thread(target=buzzer_publisher_method)
            publisherBuzzer.start()
        else:
            publisher_state_buzzer = False
            print "wasn't true"
            digitalWrite(
                buzzer_pin, 0
            )  # if the script crashes we can just press the off button and the sensors will turn off.
Пример #5
0
 def test_listen_for_dweets_from(self):
     """`listen_for_dweets_from` should hear dweets.
     """
     dweets_heard = 0
     for dweet in dweepy.listen_for_dweets_from(self.my_thing_id, timeout=5):
         dweets_heard += 1
         check_valid_dweet_response(self, dweet)
     self.assertGreater(dweets_heard, 0)
Пример #6
0
def listener(publisher, temp, hum, led, buzz, every, led_and_buzz):
    for dweet in dweepy.listen_for_dweets_from("iot2"):
        content = dweet["content"]
        sleep_time = content.get["time", ""]
        should_publish = content["publish"]
        print should_publish
        global temp_state, publisher_state, hum_state, led_state, buzz_state, every_state, led_and_buzz_state
        if should_publish == "true":
            # start the publisher thread
            publisher_state = True
            if not publisher.is_alive():
                publisher = Thread(target=publisher_method_dan)
            publisher.start()
        elif should_publish == "temp":
            # start the publisher thread
            temp_state = True
            if not temp.is_alive():
                temp = Thread(target=temp_method)
            temp.start()
        elif should_publish == "hum":
            # start the publisher thread
            hum_state = True
            if not hum.is_alive():
                hum = Thread(target=hum_method)
            hum.start()
        elif should_publish == "led":
            # start the publisher thread
            led_state = True
            if not led.is_alive():
                led = Thread(target=led_method)
            led.start()
        elif should_publish == "buzz":
            # start the publisher thread
            buzz_state = True
            if not buzz.is_alive():
                buzz = Thread(target=buzz_method)
            buzz.start()
        elif should_publish == "every":
            # start the publisher thread
            every_state = True
            if not every.is_alive():
                every = Thread(target=every_method)
            every.start()
        elif should_publish == "led_and_buzz":
            # start the publisher thread
            led_and_buzz_state = True
            if not led_and_buzz.is_alive():
                led_and_buzz = Thread(target=led_and_buzz_method)
            led_and_buzz.start()
        else:
            temp_state = False
            publisher_state = False
            hum_state = False
            led_state = False
            buzz_state = False
            every_state = False
            led_and_buzz_state = False
            print "wasn't true"
Пример #7
0
def dweet_listener(thing_name, q):
    while True:
        try:
            for dweet in dweepy.listen_for_dweets_from(thing_name):
                q.put(dweet)
                # print(dweet)
        except:
            print("no incoming messages for {}, reconnecting the listener".
                  format(thing_name))
            pass
Пример #8
0
def client_listen():
    logger.info("Starting client listener")
    while True:
        try:
            for dweep in dweepy.listen_for_dweets_from('sgsmcpi'):
                logger.info("Dweep received:\n{}".format(dweep))
                for key in dweep["content"]:
                    if key == "goodnight":
                        shutdown()
        except:
            print(traceback.format_exc(1))
Пример #9
0
def get_reports(thing, key):
    """
    Get a generator that yields dweets for a thing that validate against a key.

    For dweets that don't validate, an InvalidDweetError is yielded
    """
    for dweet in dweepy.listen_for_dweets_from(thing):
        if not verify(key, dweet['content']):
            yield InvalidDweetError('verification failed')
        else:
            yield dweet['content']['data']
Пример #10
0
        def listen_dweets(thing, callback):
            while 1:
                try:
                    print('Start listening on ' + thing)
                    for dweet in dweepy.listen_for_dweets_from(thing, timeout):
                        callback(dweet)

                except Exception as e:
                    print('Restarting listen due to exception: ' + str(e))
                    time.sleep(1)
                    pass
Пример #11
0
    def pullDweets(self):
        # dweet stream

        sleep(DELAY)

        try:
            for dweet in dweepy.listen_for_dweets_from(DWEET_STREAM):
                print dweet
                self.newDweet(dweet)

        except Exception, e:
            self.failCount += 1
            print "Total failCount:", self.failCount
            self.pullDweets()
Пример #12
0
def listener(publisher):
    for dweet in dweepy.listen_for_dweets_from('ryan-iot-dev-1'):
        content = dweet["content"]
        should_publish = content["publish"]
        print should_publish
        if should_publish == "true":
            # start the publisher thread
            global publisher_state
            publisher_state = True
            if not publisher.is_alive():
                publisher = Thread(target=publisher_method_dan)
            publisher.start()
        else:
            publisher_state = False
            print "wasn't true"
Пример #13
0
def listen():
    logger.info("Time to get the IPs for the different devices")
    ipscan()
    counter = 0
    try:
        rc = panasonic_viera.RemoteControl(iplist["bedtv"])
    except:
        logger.warning("Error initializing TV remote:\n{}".format(traceback.format_exc()))
    logger.info("Starting listener")
    while True:
        try:
            if counter > 0:
                if check_play() == False:
                    counter -= 1
                    play_random()
        except:
            print(traceback.format_exc(1))
        try:
            for dweep in dweepy.listen_for_dweets_from('sgsmcpi', 60):
                logger.info("Dweep received:\n{}".format(dweep))
                for key in dweep["content"].keys():
                    logger.info("Processing key {}".format(key))
                    if key == 'volume_up':
                        volume_up()
                    elif key == "volume_down":
                        volume_down()
                    elif key == "volume_down":
                        volume_down()
                    elif key == "play":
                        counter = 8
                        play_random()
                    elif key == "stop_play":
                        counter = 0
                        kill_mp3()
                    elif key == "wake_pc":
                        logger.info("Running wake_pc")
                        wake_pc(maclist['spc'])
                    elif key == "minoli_pc":
                        wake_pc(maclist['Minolispc'])
                    elif key == "bedtime":
                        shield_on()
                    elif key == "goodnight":
                        tv_off()
                    elif key == "wah":
                        wake_pc(maclist['worklaptop'])
        except:
            print(traceback.format_exc(1))
Пример #14
0
def listen(publisher_thread): # The listen() method takes the publisher thread as a parameter
    print(listener_thread_name + " is Listening!") # Print Starting Listening!
    global publisher_state # Set publisher state as a global variable
    publisher_state = True # Set publisher state to true
    if not publisher_thread.is_alive(): # If publisher thread is not running execute the following code
        publisher_thread.start() # Start publisher thread
    for dweet in dweepy.listen_for_dweets_from(thingOneName): # For loop listens for dweets from a specific thing called GrahamThingOne
        content = dweet["content"] # Store the content from each dweet into a variable called content
        sensor_value = content["Potentiometer"] # Get the value from the potentiometer
        thing = dweet["thing"] # Store the thing from each dweet into a variable called thing
        print("Reading from " + str(thing) + ": " + str(content))
        print("") # Adds an empty line in the terminal below our output above
        voltage = round((float)(sensor_value) * adc_ref / 1023, 2) # Calculate voltage
        degrees = round((voltage * full_angle) / grove_vcc, 2) # Calculate rotation in degrees (0 to 300)
        brightness = int(degrees / full_angle * 255) # Calculate LED brightess (0 to 255) from degrees (0 to 300)
        grovepi.analogWrite(led,brightness) # Give PWM output to LED

    print("Listening Ending!") # Print Listening Ending!
Пример #15
0
def one_round(thing='default-thing'):
	score = 0
	push_score( thing, score, '' )
	samples = []
	index = 0
	for dweet in dweepy.listen_for_dweets_from(thing):
		tilt = Tilt( dweet )
		if tilt.isValid:
			index += 1
			samples.append( tilt )

		# TODO: Compute score
		(score,text) = compute_score(
			samples,
			'%s-data.csv' % thing,
			thing,
			'x'
		)
		# TODO: Push score to client
		push_score( thing, score, text )
Пример #16
0
def listen():
    print("I am working!")
    global button_pressed

    for dweet in dweepy.listen_for_dweets_from(
            "PBturnOnLed"
    ):  # For loop listens for dweets from a specific thing called PBturnOnLed
        content = dweet[
            "content"]  # Store the content from each dweet into a variable called content
        print(str(content))
        try:
            button_pressed = content["ButtonPressed"]
        except:
            print("An exception occurred")
        thing = dweet[
            "thing"]  # Store the thing from each dweet into a variable called thing
        print("Reading from PBturnOnLed: " + str(content))
        print(thing)  # Print the variable called thing
        print("")

        try:
            # if int(button_pressed) == 1:
            #     print("On")
            #     brightness = 255
            #     grovepi.analogWrite(led,brightness) # Give PWM output to LED
            # else:
            #     print("Off")
            #     brightness = 0
            #     grovepi.analogWrite(led,brightness) # Give PWM output to LED

            if int(button_pressed) == 0:
                print("Off")
                brightness = 0
                grovepi.analogWrite(led, brightness)  # Give PWM output to LED
        except:
            print("An exception occurred")
    print("Listening Ending!")  # Print Listening Ending!
Пример #17
0
def start():
    try:
        while run:
            try:
                for dweet in dweepy.listen_for_dweets_from('315novusledwall'):

                    try:
                        dweet = json.dumps(dweet["content"])
                    except:
                        log.warning(
                            file,
                            "could not convert to JSON and extract contents")
                    try:
                        r = requests.post("http://localhost:321", data=dweet)
                    except:
                        log.warning(file, "Could not post to HTTPserver")
                    if (run == False):
                        log.warning(file, "breaking")
                        break
                    log.info(file, dweet)
            except:
                log.warning(file, "Failed to get dweet")
    except KeyboardInterrupt:
        log.warning(file, '\ngoogleAssistant: Interrupt detected')
Пример #18
0
#!/usr/bin/python 

# dweepy test SUBSCRIBE do NOT use https when testing this via swagger !
import dweepy 

try:
	thing = 'stit17tweet'
	print 'Subscribe dweet.io for thing: ' + thing
	for dweet in dweepy.listen_for_dweets_from(thing):
		print dweet

		
except KeyboardInterrupt: 
	pass
		
except Exception:
	print "Unexpected error:"
	pass

Пример #19
0
import dweepy

for dweet in dweepy.listen_for_dweets_from('torpid-brother'):
	print dweet

Пример #20
0
import dweepy
from grovepi import *
import time

led = 8

pinMode(led,"OUTPUT")
time.sleep(1)

for dweet in dweepy.listen_for_dweets_from('ryan-iot-dev-1'):
    while True:
        try:
            digitalWrite(led,1)
            time.sleep(3)
            digitalWrite(led,0)

    
            
Пример #21
0
import time

base_url = 'https://pogoleam.orangeninja.com/api/1.0/'
begin_end_pause = 0.5
scroll_delay = 0.01

locationData = requests.get(url=base_url + 'locations')
locationNames = {}
for location in locationData.json():
    locationNames[location['_id']] = location['name']

pokemon_names = requests.get(url=base_url + 'pokemon').json()

displ_width = scrollphathd.get_shape()[0]

for dweet in dweepy.listen_for_dweets_from('pogoleam'):
    task = dweet['content']['task']
    stop_id = dweet['content']['stopID']
    reward = dweet['content']['reward']
    reward_num = dweet['content']['number']
    if reward == 'Encounter':
        names = []
        for dex_num in reward_num:
            names.append(pokemon_names[dex_num - 1])
        reward_str = '/'.join(names)
    else:
        reward_str = reward_count + ' ' + reward
    stopName = locationNames[stop_id]
    text = stopName + ': ' + task + ' for ' + reward_str
    print text
    # Show message on screen
Пример #22
0
import dweepy
import requests


for dweet in dweepy.listen_for_dweets_from('lat-soundsystem'):
    print(dweet)
    requests.post("http://localhost/webhook/", json=dweet)
Пример #23
0
#!/usr/bin/python

import dweepy
import os
import re

path = os.path.dirname(os.path.realpath(__file__))

for dweet in dweepy.listen_for_dweets_from(os.environ['DWEETID']):
    for k, v in dweet['content'].iteritems():
        fname = path + '/' + ('run-' + k + '.py').replace('/', '')
        if os.path.isfile(fname):
            v = re.sub('[^a-zA-Z0-9]', '', str(v))
            print fname, v
            os.system(fname + ' ' + v)

Пример #24
0
import dweepy
import subprocess

for dweet in dweepy.listen_for_dweets_from('LauraPi'):
    for content in dweet:
        if content.find("hello "):
            subprocess.call(['python', 'led_blink.py'])
        elif content.find("moisture"):
            subprocess.call([
                'python', '/home/pi/GrovePi/Software/Python/grove_moisture.py'
            ])
        else:
            print dweet
Пример #25
0
def listener(publisher_thread):
    print "listener thread..."
    for dweet in dweepy.listen_for_dweets_from('canary30_iot'):
        global lights_state                         #declaring global variable for sensor and actuator states
        global motion_state
        global Pan_state
        global Tilt_state

        print "Got the dweet things"

        my_dweet = dweet                            #creating a new variable my_dweet
        content = my_dweet["content"]               #my_dweet contains "content" which has the JSON dweet values
        lights_state = content["lights"]            #String lights is declared to lights_state
        Pan_state = content["pan"]                  #String pan is declared to Pan_state
        Tilt_state = content ["tilt"]               #String tilt is declared to Tilt_state

        print "Contents opened"

        # Lights
        if lights_state == "true":                  #This if statement turns on lights if lights equals to true
            LEDRight.write(1)
            LEDLeft.write(1)
            print "Right light is ON"
            lights_state = "On"


        elif lights_state == "false":               #This if statement turns off lights if lights equals to false
            print "<<<Turn off Right Light>>>"
            LEDRight.write(0)
            LEDLeft.write(0)
            print "<<<Right light is OFF>>>"
            lights_state = "Off"

        # Pan Right
        if Pan_state == "true":                     # This if statement turns the camera right if equals to true
            servoPan.enable(False);
            servoPan.pulsewidth_us(500)
            servoPan.enable(True);
            time.sleep(1)
            servoPan.enable(False);
            print "Pan turnned right"
            Pan_state = "right"

        # Pan Center
        elif Pan_state == "false":                  # This if statement turns the camera facing forward if equals to false
            servoPan.enable(False);
            servoPan.pulsewidth_us(1200)
            servoPan.enable(True);
            time.sleep(1)
            servoPan.enable(False);
            print "Pan is looking forward"
            Pan_state = "center"


        # Pan left
        if Pan_state == "left":
            servoPan.enable(False);
            servoPan.pulsewidth_us(2000)
            servoPan.enable(True);
            LEDLeft.write(1)
            time.sleep(1)
            servoPan.enable(False);
            print "Pan turned left"
            Pan_state = "left"

        elif Tilt_state == "down":
            servoTilt.enable(False);
            servoTilt.pulsewidth_us(1050)
            servoTilt.enable(True);
            time.sleep(1)
            servoTilt.enable(False);
            print "Tilted DOWN"
            Tilt_state = "up"

        # Tilt camera Up
        if Tilt_state == "true":
            servoTilt.enable(False);
            servoTilt.pulsewidth_us(650)
            servoTilt.enable(True);
            time.sleep(1)
            servoTilt.enable(False);
            print "Tilted UP"
            Tilt_state = "up"

        # Straighten camera
        elif Tilt_state == "false":
            servoTilt.enable(False);
            servoTilt.pulsewidth_us(850)
            servoTilt.enable(True);
            time.sleep(1)
            servoTilt.enable(False);
            print "Camera Level"
            Tilt_state = "straight"


        # PIR Motion Sensor
        if pir.value():                                     #The Motion sensor sends its values to canary30_iot
            print "***Motion is ON***"
            result = dweepy.dweet_for('canary30_pir', {'pir': "true"})
            print result
            dict= pir.value()

            # saves data to a local file (Canary_Backup_Data.txt) only when motion was detected
            backupFile = open('Canary_Backup_Data.txt', 'a')
            stringToWrite = str(dict)
            timeToWrite = datetime.datetime.now().strftime(dateString)
            backupFile.write(timeToWrite + " " + stringToWrite + '\n')
            backupFile.close()


        else:
            print "<<<Moton is OFF>>>"
            result = dweepy.dweet_for('canary30_pir', {'pir': "false"})
            print result
            time.sleep(2)


        if publisher_thread.is_alive():         # Activate or continue publisher
            print "Yes it is alive"
        else:
            publisher_thread.start()
Пример #26
0
#!/usr/bin/env python
import time
import dweepy
import RPi.GPIO as GPIO

KEY = 'tweet_about_me'
OUTPUT_PIN = 18
OUTPUT_DURATION = 10

GPIO.setmode(GPIO.BCM)
GPIO.setup(OUTPUT_PIN, GPIO.OUT)

while True:
    try:
        for dweet in dweepy.listen_for_dweets_from(KEY):
            print('Tweet: ' + dweet['content']['text'])
            GPIO.output(OUTPUT_PIN, True)
            time.sleep(OUTPUT_DURATION)
            GPIO.output(OUTPUT_PIN, False)
    except Exception:
        pass
Пример #27
0
 def listen_for_sensor_data(self, sensor_data, timeout=100):
     print('Listening for data from: ' + sensor_data['adv_data']['rt_data'])
     for data in dweepy.listen_for_dweets_from(sensor_data['adv_data']['rt_data'], timeout):
         retval = data['content']
         yield retval
Пример #28
0
	push_score( thing, 10, 'You rock like Mike' )
	time.sleep(5)
	push_score( thing, 12, 'OMG!!! You have outperformed Mike' )
	time.sleep(3)
	push_score( thing, 10, 'You rock like Mike' )

def simple_test(thing):
	return compute_score( None, 'data-set2.csv', 'ill-fated-anger', 'x' )

def blah_test():
	print simple_test( 'data-set2' )

if __name__ == '__main__':
	# Wait for a message
	print 'Waiting for start...'
	for dweet in dweepy.listen_for_dweets_from('si-hacks-2015-05-16-blah-start', timeout=10):
		print dweet
		try:
			runner = threading.Thread(
				#target=one_round,
				target=test_round,
				kwargs=dict(
					thing=dweet['content']['thing']
				)
			)
			runner.start()
			runner.join( 1*60 ) # limit the round to 1 minute
		except:
			print 'error'
			raise
Пример #29
0
  return to_low + (value / scale_factor)
  
  
def set_angle(channel, angle):  
  pulse = int(map(angle, 0, 180, servoMin, servoMax))
  pwm.setPWM(channel, 0, pulse)
  
def dance_step(step):  
  set_angle(0, step[0])
  set_angle(1, step[1])
  set_angle(2, step[2])
  set_angle(3, step[3])
  
def dance_pupet():    # 3
    for i in range(1, 10):
        for step in dance:
            dance_step(step)
            time.sleep(delay)
    
pwm.setPWMFreq(60)   

      
while True:
    try:   # 2
        for dweet in dweepy.listen_for_dweets_from(dweet_key):   # 4
            print("Dance Pepe! Dance!")
            mixer.music.play()
            dance_pupet()
    except Exception:
        pass
Пример #30
0
import dweepy

for dweet in dweepy.listen_for_dweets_from('raspberryPI'):
    print dweet
#!/usr/bin/env python
import time
import dweepy
import RPi.GPIO as GPIO

KEY = 'tweet_about_me'
OUTPUT_PIN = 18
OUTPUT_DURATION = 10


GPIO.setmode(GPIO.BCM)
GPIO.setup(OUTPUT_PIN, GPIO.OUT)

while True:
    try:
        for dweet in dweepy.listen_for_dweets_from(KEY):
            print('Tweet: ' + dweet['content']['text'])
            GPIO.output(OUTPUT_PIN, True)
            time.sleep(OUTPUT_DURATION)
            GPIO.output(OUTPUT_PIN, False)
    except Exception:
        pass
Пример #32
0
def getPic():
    for dweet in dweepy.listen_for_dweets_from('deanDronePI'):
        #grabbing the relevant data from dweet
        content1 = dweet["content"]
        How_Big = content1["acres"]
        content = dweet["content"]
        How_long = content["interval"]




        #seting the gpio board numbering convention
        GPIO.setmode(GPIO.BOARD)
        servo=11
        #setting the control gpio pin
        GPIO.setup(servo, GPIO.OUT)
        #reading/reseting the servo for use
        pwm=GPIO.PWM(servo,50)
        pwm.start(7)


        def SetAngle(angle):
            #defining the duty cycle for the servo to read
            #this formula roughly translates into degrees
            duty = angle / 18 + 2
            #sets the gpio pin as an output pin
            GPIO.output(11, True)
            #alters the pwm to follow the duty cycle
            pwm.ChangeDutyCycle(duty)
            sleep(1)
            #closes the pin and resets the pwm
            GPIO.output(11, False)
            pwm.ChangeDutyCycle(0)
        #sets the angle to 55 degrees
        SetAngle(55)

        x = How_Big*3
        flight_time = x*2

        sleep(flight_time)
        SetAngle(45)

        def post (statistics):
        	thing = 'deanDronePI'


        #pushing the alarm data to dweet
        def publishing():
                statistics = {}
                statistics["pic"] = 10
                return statistics
                time.sleep(10)
                statistics = {}
                statistics["pic"] = 0
                return statistics

        SetAngle(35)
        sleep(flight_time)

        #stopping the pulse cycle and cleaning up the pins
        pwm.stop()
        GPIO.cleanup()