def __init__(self): self.led1 = None self.pwm1 = None try: self.led1 = led(248) except ValueError: self.pwm1 = Pwm(0, True, 0) self.led2 = None self.pwm2 = None try: self.led2 = led(249) except ValueError: #self.pwm2 = Pwm(1, True, 0) pass # Red is always on, green and blue don't work # But the Tadpole does work for red and green using the same values # I believe my Calamari is bad self.led3 = rgb(82, 83, 208) self.s1 = button(216, True) self.s2 = button(227, True) self.s3 = button(226, True) # Need to test ssg, not working either... self.sseg = Seg7() # Requires Calamari kernel driver self.adc = calamari_adc()
def check_config(): internet_connection = has_internet() internet_light = led.led(20) if internet_connection: internet_light.on() else: internet_light.off() try: logger.write('Uploading status file...') status_file = status.update_status(False, False, False) status.upload_status(status_file, False) logger.write('Upload complete.') except Exception as e: logger.write('An error occurred while uploading a status file.') logger.write(str(e)) try: logger.write('Cloud: Checking for new configuration.') credential_path = 'credentials.ini' credentials = configparser.ConfigParser() credentials.read(credential_path) username = credentials.get('Azure', 'Username') password = credentials.get('Azure', 'Password') blob_service = BlockBlobService(account_name=username, account_key=password) generator = blob_service.list_blobs('configuration') for b in generator: timestamp = b.properties.last_modified break # The dumbest bullshit I have ever experienced last_modified = datetime.datetime.fromtimestamp(os.path.getmtime('config.ini')) last_modified = last_modified.replace(tzinfo=datetime.timezone.utc).astimezone(tz=datetime.timezone.utc) last_modified += datetime.timedelta(hours=time.altzone / 60 / 60) if timestamp > last_modified: logger.write('Downloading new configuration.') blob_service.get_blob_to_path('configuration', 'config.ini', 'config.ini') logger.write('Rebooting...') #TODO: Clean-up step power = led.led(27) gps = led.led(22) internet = led.led(20) power.off() gps.off() internet.off() os.system('sudo reboot') else: logger.write('No new configuration found.') except Exception as e: logger.write(str(e)) logger.write('CheckConfig: There was an error connecting to the cloud.\n') return
def indication(): # Функция Нахождения чисел global mas, col_det, land rospy.sleep(5.5) col_det.Num = True rospy.sleep(0.5) print(col_det.number) if col_det.number != -1: led(col_det.number) # Индикация d = col_det.message mas[col_det.number] = 0 D_delivered(col_det.number, mas[col_det.number]) #print navigate(x=col_det.number_x, y=col_det.number_y, z=col_det.startz.range-0.1, speed=0.5, frame_id='aruco_map') if land == True: # Посадка если мы это захотели print navigate(x=0, y=0, z=-0.2, speed=0.5, frame_id='body') rospy.sleep(1) land() rospy.sleep(10) print navigate(x=0, y=0, z=1, speed=0.5, frame_id='body', auto_arm=True) rospy.sleep(5) led(-1) print(d)
def myISR(self, ev=None): flag = 0 fire = "Active Fire" gas = "No" life = "No" temp = "No" self.flag = GPIO.input(self.FlamePin) print(GPIO.input(self.FlamePin)) self.sensorStatus = "fire" + str(GPIO.input(self.FlamePin)) if self.sensorStatus == "fire1": self.setstatus() print("Flame is detected !") led.led().ledOff(33) led.led().ledOn(31) buzzer.buzzer().controllRunOn(7) print(str(datetime.datetime.now())) print("\nReading TEMPRATURE of affected area") temprature() time.sleep(2) print("\nDetecting Life in affected area") if motion(22, 40, 38).flag == 1: life = "Presence of life in the affected area" time.sleep(2) time.sleep(2) flag = flag + 1 cam.cam("fire") if flag != 0: email().emailSend("fire.png", "/home/pi/project/fire.png", temp, life, fire) print("Mail Sended") sms.sms("Number to send") flag = 0 print("Detecting LPG lekage in area") gasT.gas(38).grun() buzzer.buzzer().controllRunOff(7)
def __init__(self): self.full = led.led(11) self.high = led.led(13) self.nomask = led.led(15) self.immask = led.led(7) self.okay = led.led(19) self.fullErrorOn() sleep(0.2) self.highErrorOn() sleep(0.2) self.noMaskErrorOn() sleep(0.2) self.imMaskErrorOn() sleep(0.2) self.okayOn() sleep(1.2) self.fullErrorOff() sleep(0.2) self.highErrorOff() sleep(0.2) self.noMaskErrorOff() sleep(0.2) self.imMaskErrorOff() sleep(0.2) self.okayOff()
def indication(): global mas, col_det, land rospy.sleep(5.5) col_det.Num = True rospy.sleep(0.5) print(col_det.number) if col_det.number != -1: led(col_det.number) d = col_det.message mas[col_det.number] = 0 D_delivered(col_det.number, mas[col_det.number]) #print navigate(x=col_det.number_x, y=col_det.number_y, z=col_det.startz.range-0.1, speed=0.5, frame_id='aruco_map') if land == True: print navigate(x=0, y=0, z=-0.2, speed=0.5, frame_id='body') rospy.sleep(1) land() rospy.sleep(10) print navigate(x=0, y=0, z=1, speed=0.5, frame_id='body', auto_arm=True) rospy.sleep(5) led(-1) print(d)
def indication(): global mas, col_det rospy.sleep(3.5) col_det.Num = True rospy.sleep(0.5) if col_det.number != -1: led(col_det.number) print navigate(x=self.x_dist, y=self.y_dist, z=self.startz.range - 0.1, speed=0.5, frame_id='aruco_map') rospy.sleep(1) land() rospy.sleep(4) led(-1) rospy.sleep(2) print navigate(x=0, y=0, z=1, speed=0.5, frame_id='body', auto_arm=True) rospy.sleep(3) print(col_det.message) D_delivered(col_det.number, mas[col_det.number]) mas[col_det.number] = 0
def __init__(self): #オブジェクトの生成 self.rightmotor = motor.motor(ct.const.RIGHT_MOTOR_IN1_PIN, ct.const.RIGHT_MOTOR_IN2_PIN, ct.const.RIGHT_MOTOR_VREF_PIN) self.leftmotor = motor.motor(ct.const.LEFT_MOTOR_IN1_PIN, ct.const.LEFT_MOTOR_IN2_PIN, ct.const.LEFT_MOTOR_VREF_PIN) self.gps = gps.GPS() self.bno055 = bno055.BNO055() self.radio = radio.radio() self.RED_LED = led.led(ct.const.RED_LED_PIN) self.BLUE_LED = led.led(ct.const.BLUE_LED_PIN) self.GREEN_LED = led.led(ct.const.GREEN_LED_PIN) #開始時間の記録 self.startTime = time.time() self.timer = 0 self.landstate = 0 #landing stateの中でモータを一定時間回すためにlandのなかでもステート管理するため self.v_right = 100 self.v_left = 100 #変数 self.state = 0 self.laststate = 0 self.landstate = 0 #stateに入っている時刻の初期化 self.preparingTime = 0 self.flyingTime = 0 self.droppingTime = 0 self.landingTime = 0 self.pre_motorTime = 0 self.waitingTime = 0 self.runningTime = 0 self.goalTime = 0 #state管理用変数初期化 self.countPreLoop = 0 self.countFlyLoop = 0 self.countDropLoop = 0 self.countGoal = 0 self.countAreaLoopEnd = 0 # 終了判定用 self.countAreaLoopStart = 0 # 開始判定用 self.countAreaLoopLose = 0 # 見失い判定用 self.countgrass = 0 #GPIO設定 GPIO.setmode(GPIO.BCM) #GPIOの設定 GPIO.setup(ct.const.FLIGHTPIN_PIN, GPIO.IN) #フライトピン用 date = datetime.datetime.now() self.filename = '{0:%Y%m%d}'.format(date) self.filename_hm = '{0:%Y%m%d%H%M}'.format(date) if not os.path.isdir( '/home/pi/Desktop/wolvez2021/Testcode/EtoEtest/%s/' % (self.filename)): os.mkdir('/home/pi/Desktop/wolvez2021/Testcode/EtoEtest/%s/' % (self.filename))
def __init__(self, red_pin, green_pin, blue_pin, red_low=False, green_low=False, blue_low=False): self._r = led(red_pin, red_low) self._g = led(green_pin, green_low) self._b = led(blue_pin, blue_low)
def __init__(self, speech_object, led_lamp_object, led_magic_object, hand_object): self.list_of_phrases = ("effects/20.mp3", "welcome/5.mp3", "effects/31.mp3") self.hand_object = hand_object self.led_lamp_object = led_lamp_object self.led_magic_object = led_magic_object self.speech_object = speech_object self.pin = denexapp_config.super_button_pin self.led_pin = denexapp_config.super_button_led_pin self.phase_duration = denexapp_config.super_button_phase_duration self.led_button_object = led.led(self.led_pin, denexapp_config.super_button_led_blink_period, invert=True) self.current_phase = 0 # 1 - hand moving, 2 - hand moving + sphere lightning, 3 - hand+sphere+speech self.presses_in_a_row = 0 # times button pressed in a row during one 'session' self.button_blocked = False # deactivates button's affect on the robot self.button_unblock_time = None # time when button's affect will be unblocked self.processes_are_executing = False self.led_button_object.start_blink() self.phase_start_time = 0 self.is_magic_now = False GPIO.setmode(GPIO.BCM) GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # pin of button, takes 1 and 0
def __init__(self): global ms global c global l ms = motionSensor() c = camera() l = led()
def main(): r = sr.Recognizer() # Instantiate IFTTT Webhooks object. webhooks = ifttt_webhooks('402LsIog5lt0cMATLnmtb') webhooks_keyword = 'activate ' # Instantiate led object. red_led = led() pg.mixer.init() pg.mixer.music.load("../audio/can_i_help_you.wav") pg.mixer.music.play() while pg.mixer.music.get_busy() == True: continue while True: with sr.Microphone() as source: print("Speak Anything :") audio = r.listen(source, None, 2) try: #TODO Use Sphynx since it's offline. text = r.recognize_google(audio) print("You said : {}".format(text)) if text.startswith(webhooks_keyword): pg.mixer.init() pg.mixer.music.load("../audio/noted.wav") pg.mixer.music.play() while pg.mixer.music.get_busy() == True: continue event_name = text[len(webhooks_keyword):] webhooks.trig(event_name) elif text.startswith('turn on'): red_led.turn_on() pg.mixer.init() pg.mixer.music.load("../audio/activated.wav") pg.mixer.music.play() while pg.mixer.music.get_busy() == True: continue elif text.startswith('turn off'): red_led.turn_off() pg.mixer.init() pg.mixer.music.load("../audio/shutting_down.wav") pg.mixer.music.play() while pg.mixer.music.get_busy() == True: continue elif text.startswith('goodbye'): red_led.turn_off() pg.mixer.init() pg.mixer.music.load("../audio/goodbye.wav") pg.mixer.music.play() while pg.mixer.music.get_busy() == True: continue sys.exit(0) except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print( "Could not request results from Google Speech Recognition service; {0}" .format(e))
def __init__(self, FlamePin): self.FlamePin = FlamePin print("Running") GPIO.setmode(GPIO.BOARD) GPIO.setup(self.FlamePin, GPIO.IN, pull_up_down=GPIO.PUD_UP) led.led().ledOn(40) buzzer.buzzer().run(7, 0.4) led.led().ledOff(31) led.led().ledOn(33)
def indication(): global mas, col_det rospy.sleep(3.5) col_det.Num = True rospy.sleep(0.5) if col_det.number != -1: led(col_det.number) print navigate(x=col_det.number_x, y=col_det.number_y, z=1.5, speed=0.5, frame_id='aruco_map') rospy.sleep(5) led(-1) rospy.sleep(2) print navigate(x=0, y=0, z=1, speed=0.5, frame_id='body', auto_arm=True) rospy.sleep(3) print(col_det.message) mas[col_det.number] = 0
def __init__(self, pir, red, green): GPIO.setmode(GPIO.BOARD) self.flag = 0 GPIO.setup(pir, GPIO.IN) print("Waiting for sensor to settle") time.sleep(2) print("Detecting motion") l = led.led() for i in range(0, 10): if GPIO.input(pir): print("Motion Detected!") self.flag = 1 self.sensorStatus = "motion1" self.setstatus() print("\nPassing control to GAS Sensor") break time.sleep(0.1)
def record(recording_length, path): ''' Perform a recording of the designated length and save it to the designated path. Returns true if the recording succeeds and false if there is an exception thrown. ''' recording_light = led.led(17) # GPIO 16 = Recording LED recording_light.on() try: os.system('arecord --device=hw:U22,0 --format S32_LE --rate 44100 --channels=2 --duration=' + str(recording_length) + ' ' + path + '.wav') except Exception as e: logger.write('An error occurred while recording.') logger.write(str(e)) recording_light.off() return False recording_light.off() return True
def setup_read_motion(self): print("Connecting") self.vehicle = connect('/dev/ttyS0', wait_ready=True, baud=57600, rate=2, use_native=True, heartbeat_timeout=-1) self.MODE = mode(self.vehicle) self.CAMERA = detect() self.led = led() self.ROCK = rocking_wings(self.vehicle) self.count = 0 self.flag = 0 self.flag_count = 25 self.dt = 0.1 self.RED_CIRCLE = 0 self.BLUE_SQUARE = 0 self.mode_thread = Scheduler(self.MODE.updateMode, 0.5) self.rock_thread = Scheduler(self.ROCK.read_motion, 0.25) self.mode_thread.start() print("Complite Initial Setup") self.led.flash_second(3)
#!/usr/bin/env python import led led=led.led() led.blackout()
payment_state = 0 # 0 - no money, 1 - part of money, 2 - enough money last_magic_time = time.time() - 2*dconfig.payment_afterpay_time # last time of prediction last_far_time = time.time() - 2 * (dconfig.repeat_time_far / 1000) # last time of speech when user is far last_close_time = time.time() - 2 * (dconfig.repeat_time_close / 1000) # last time of speech when user is close last_close_state_time = time.time() - 2 * dconfig.user_gone_timeout / 1000 last_far_state_time = time.time() - 2 * dconfig.user_gone_timeout / 1000 # camera_object = camera.camera() hand_object = hand.hand() breathing_object = breathing.breathing() speech_object = speech.speech() led_payment_object = led.led(dconfig.led_payment_pin, dconfig.led_payment_period) led_lamp_object = led.led(dconfig.led_lamp_pin, 0) led_waiting_object = led.led(dconfig.led_waiting_pin, 0) led_magic_object = led.led(dconfig.led_magic_pin, 0) led_card_object = led.led(dconfig.led_card_pin, 0) motion_detector_object = motion_detector.motion_detector( dconfig.motion_detector_pin, dconfig.motion_detector_power_pin) card_dispenser_object = card_dispenser.card_dispenser() money_acceptor_object = money_acceptor.money_acceptor() gsm_object = gsm.gsm(money_acceptor_object, card_dispenser_object) ups_object = ups.ups(gsm_object) super_button_object = super_button.SuperButton(speech_object, led_lamp_object, led_magic_object, hand_object) super_button_object.activate_button() ups_object.start_monitoring()
def test_1_needs_2_leds(self): self.assertEqual(2, led(1))
def test_11_needs_4_leds(self): self.assertEqual(4, led(11))
def test_9_needs_6_leds(self): self.assertEqual(6, led(9))
def __init__(self): led.led().ledOff(29) led.led().ledOff(31) led.led().ledOff(33) led.led().ledOff(40) GPIO.cleanup()
def led_off(): led(LEDPINS, False, -1) return render_template('led_off.html')
def __init__(self): self.evt = event.Event() self.motion = motion.Motion() #sencor class self.shoot = shoot.Shoot() #actuator class self.upload = upload.Upload() #actuator class self.led = led.led()
def subroutine(): res = requests.get("http://e5b95c82.ngrok.io/testImage") print res.content led(res.content)
def upload_recording(filename: str, config): upload_light = led.led(16) # GPIO 20 is the Uploading indicator upload_light.on() try: logger.write('Uploading status file...') status_file = status.update_status(False, True, False) status.upload_status(status_file, False) logger.write('Upload complete.') except Exception as e: logger.write('An error occurred while uploading a status file.') logger.write(str(e)) try: start = time.time() logger.write('Uploading...') credential_path = 'credentials.ini' credentials = configparser.ConfigParser() credentials.read(credential_path) container = config.get('Cloud', 'container') username = credentials.get('Azure', 'Username') password = credentials.get('Azure', 'Password') block_blob_service = BlockBlobService(account_name=username, account_key=password) # Force chunked uploading and set upload block sizes to 8KB block_blob_service.MAX_SINGLE_PUT_SIZE=16 block_blob_service.MAX_BLOCK_SIZE=8*1024 timestamp = os.path.basename(filename).split('.')[0] extension = os.path.basename(filename).split('.')[1] timestamp_day = timestamp.split('_')[1] timestamp_time = timestamp.split('_')[2] timestamp_day = timestamp_day.replace('-', '_') timestamp_time = timestamp_time.replace('-', '_') blob_name = timestamp_day + '/' + timestamp_time + '/recording.' + extension block_blob_service.create_blob_from_path(container, blob_name, filename) end = time.time() elapsed = end - start logger.write('Upload Succeeded: ' + blob_name) logger.write('Upload took ' + str(elapsed) + ' seconds.\n') if REMOVE_RECORDINGS: os.remove(filename) except Exception as e: logger.write('CheckConfig: There was an error uploading to the cloud.') logger.write(str(e)) upload_light.off() return upload_light.off() logger.write('Upload complete') try: logger.write('Uploading status file...') status_file = status.update_status(False, False, False) status.upload_status(status_file, False) logger.write('Upload complete.') except Exception as e: logger.write('An error occurred while uploading a status file.') logger.write(str(e))
import sam import led led.led_h() led.led_h() led.led() sam.gcd(2, 20)
if out is True: return red,green,blue green=255 for red in range(0,255): if cc==val: out=True break green=green-1 cc=cc+1 if out is True: return red,green,blue else: return 255,0,0 print "Server-Url:\t{0}\nReload every\t{1} Sec\n".format(TEMPURL,SLEEPTIME) led=led() reqnum=1 try: while True: data=urllib2.urlopen(TEMPURL).read() xml=minidom.parseString(data) temp=xml_get_tag_data("temp",xml) timestamp=xml_get_tag_data("timestamp",xml) temp_col=int(round(range_convert(temp,MIN_TEMP,MAX_TEMP))) date_human=time.strftime("%d.%m.%Y %H:%M:%S",time.gmtime(timestamp)) r,g,b=col(temp_col) led.rgbw(r,g,b) print "#{3}\t{0}\t{1}°C\t\tscore={2}/512".format(date_human,temp,temp_col,reqnum) reqnum=reqnum+1 time.sleep(SLEEPTIME)
def __init__(self, neopixels_instance, opts={}, leds=[]): self.pixels = neopixels_instance if len(leds) == 0: self.leds = [led(self.pixels, i, opts) for i in range(NUMPIXELS)] else: self.leds = leds
def test_0_needs_6_leds(self): self.assertEqual(6, led(0))
def update_status(is_recording, is_uploading, fatal_error): ''' GPS Coordinates Temperature IsRecording IsUploading ''' latitude = '?' longitude = '?' try: gps_light = led.led(22) logger.write('Synchronizing clock with GPS...') fix, current_time, latitude, longitude = gpsutil.getGPSInfo() if fix == True: logger.write('GPS Fix established.') gps_light.on() try: os.system('sudo date -s ' + current_time) except Exception as e: logger.write(str(e)) pass else: logger.write('GPS Fix failed.') latitude = '?' longitude = '?' gps_light.off() except Exception as e: logger.write('Something with the GPS raised an exception.') logger.write(str(e)) gps_light.off() fix = False latitude = '?' longitude = '?' return temp = '?' try: temp_sensor = MCP9808.MCP9808() online = temp_sensor.begin() if not online: temp = '?' else: temp = temp_sensor.readTempC() except Exception as e: logger.write('Something with the temperature sensor raised an exception.') logger.write(str(e)) status_file = open('status.ini', 'w') status_file.writelines('''[GPS] Latitude = %s Longitude = %s [Temperature] Celsius = %s [Status] IsRecording = %s IsUploading = %s FatalError = %s ''' % (str(latitude), str(longitude), temp, str(is_recording), str(is_uploading), str(fatal_error))) return 'status.ini'
def test_141_needs_8_leds(self): self.assertEqual(8, led(141))
def subroutine(): res = requests.get("http://b4cdb600.ngrok.io/testImage") print res.content led(res.content)
def test_2_needs_5_leds(self): self.assertEqual(5, led(2))
def test_3_needs_5_leds(self): self.assertEqual(5, led(3))
def led_on(id): led(LEDPINS, True, id) return render_template('led_on.html')
def test_4_needs_4_leds(self): self.assertEqual(4, led(4))
import led import time pin = int(input('Enter pin')) period = int(input('Enter period')) led_object = led.led(pin, period) led_object.start_blink() while True: time.sleep(3)
def test_5_needs_5_leds(self): self.assertEqual(5, led(5))
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' font9 = "-family {DejaVu Sans} -size 20 -weight bold -slant " \ "roman -underline 0 -overstrike 0" top.geometry("600x450+491+150") top.title("Admin") led.led().ledOn(29) self.master = top self.Label1 = Label(top) self.Label1.place(relx=0.18, rely=0.09, height=69, width=356) self.Label1.configure(font=font9) self.Label1.configure(text='''Admin Panel''') self.Label1.configure(width=356) self.Label2 = Label(top) self.Label2.place(relx=0.22, rely=0.38, height=19, width=76) self.Label2.configure(text='''User-ID :''') self.Label2.configure(width=76) self.Label3 = Label(top) self.Label3.place(relx=0.2, rely=0.47, height=19, width=86) self.Label3.configure(text='''Password :''') self.Label3.configure(width=86) self.userBox = Entry(top) self.userBox.place(relx=0.38, rely=0.38, height=21, relwidth=0.31) self.userBox.configure(background="white") self.userBox.configure(font="TkFixedFont") self.userBox.configure(width=186) self.pwdBox = Entry(top) self.pwdBox.place(relx=0.38, rely=0.47, height=21, relwidth=0.31) self.pwdBox.configure(background="white") self.pwdBox.configure(font="TkFixedFont") self.pwdBox.configure(width=186) self.pwdBox.configure(show="*") self.loginbtn = Button(top) self.loginbtn.place(relx=0.22, rely=0.58, height=27, width=97) self.loginbtn.configure(activebackground="#d9d9d9") self.loginbtn.configure(text='''Login''') self.loginbtn.configure(width=97) self.loginbtn.configure(command=self.login) self.pwdbtn = Button(top) self.pwdbtn.place(relx=0.52, rely=0.58, height=27, width=97) self.pwdbtn.configure(activebackground="#d9d9d9") self.pwdbtn.configure(text='''Cancel''') self.pwdbtn.configure(width=97) self.pwdbtn.configure(command=self.clear) self.result = StringVar() self.result.set("") self.resultMessage = Label(top) self.resultMessage.place(relx=0.22, rely=0.76, height=59, width=306) self.resultMessage.configure(width=306) self.resultMessage.configure(textvariable=self.result)
def test_6_needs_6_leds(self): self.assertEqual(6, led(6))
# set up inputs GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) # blue button GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP) # yellow button motorA = motor(17,27) motorB = motor(22,10) gyro=mpu6050() gyro.setFilter(2) greenLed = led(24) yellowLed = led(25) greenLed.on() yellowLed.off() # regulator settings Ta = 0.05 Time =120 / Ta regulator = pid() regulator.setKp(20) #regulator.setKi(0.2) #regulator.setKd(3) regulator.setTa(4*Ta) regulator.setMinMax(-100,100) regulator.setTarget(-1.2)
def test_7_needs_3_leds(self): self.assertEqual(3, led(7))
def test_8_needs_7_leds(self): self.assertEqual(7, led(8))
output_operation = graph.get_operation_by_name(output_name) with tf.Session(graph=graph) as sess: start = time.time() results = sess.run(output_operation.outputs[0], {input_operation.outputs[0]: t}) end = time.time() results = np.squeeze(results) top_k = results.argsort()[-5:][::-1] labels = load_labels(label_file) print('\nEvaluation time (1-image): {:.3f}s\n'.format(end - start)) template = "{} (score={:0.5f})" led = led() buzzer = buzzer() email = email() for i in top_k: #print(template.format(labels[i], results[i])) if (labels[i] == "shantanu" and results[i] >= 0.9): print("Match Found For Shantanu") led.run(13, 1) buzzer.run(36, 0.5) readWrite.csvWrite("babyMovents.csv", 1, 0, 0, 0, 0) break elif (labels[i] == "lion" and results[i] >= 0.9): print("Match Found For Lion") readWrite.csvWrite("babyMovents.csv", 0, 1, 0, 0, 0) break
#!/usr/bin/python from button import button from led import led from setup import setup from loop import loop # Open a file fo = open("arduino.c", "w") b = button(9) le = led(12) s = setup() s.addComposant(b) s.addComposant(le) fo.write(str(s.arduino())) lo = loop() lo.addRead(["BUTTON9", "BUTTON10"]) lo.addActionIf(["BUTTON9", "BUTTON10"], "dualPush", ["active"], "LED12") fo.write(str(lo.arduino())) # Close opend file fo.close()
def __init__(self): led.led().ledOn(29) commandCenter.fire(36).run()