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() money_acceptor_object.start() gsm_object.start() # camera_object.start_detection() motion_detector_object.start_detection() time.sleep(1) gsm_object.send_power_on() time.sleep(4) # 0 - no user, 1 - user is far, 2 - user is close
def __init__(self, f): self.file = f self.gsm = gsm.gsm(big_endian)
from gsm import gsm g = gsm() g.isready(g.ser) g.connectgsm(g.ser, g.apn) g.connectTCP(g.ser, g.host, 80) g.sendHTTPRequest_GET(g.ser, g.host, g.request) g.sendHTTPRequest_POST(g.ser, g.host, g.request_post)
return math.sin(5 * x) + (x - 5)**2 def f2_prime(x): return 5 * math.cos(5 * x) + 2 * (x - 5) def f2_prime2(x): return -25 * math.sin(5 * x) + 2 if __name__ == '__main__': print('問題1') print('-------黄金分割法-----------') gsm(f1, 0, 10) print('-------二分割法----------') bm(f1_prime, 0, 10) print('---------ニュートン法----------') newton(f1_prime, f1_prime2, 5) print('問題2') print('-------黄金分割法-----------') gsm(f2, 0, 15) print('-------二分割法----------') bm(f2_prime, 0, 12) print('---------ニュートン法----------')
import icamera import time import gsm print '\n\n...................VEHICLE TRACKER..............\n\n\n' ##velocity,speed = ultrasonic.ultrasonic() speed = ultrasonic.ultrasonic() if (speed > 40): print '\n\nRule Break : Out of speed\n\n' ##x,y,z=accelerometer. accelerometer() stri = str(time.time()) + '.jpg' no_plate = icamera.mycamera(stri) #no_plate=' ' p = no_plate gsm.gsm(p) opt = raw_input('Do you want to search a particular vehicle? : (y/n)') if opt == 'y': no_plate_check = input('Enter vehicle no : ') if no_plate == no_plate_check: print 'Found' else: print 'Not found' else: print 'ok' print '\n\nODD...EVEN\n\n' if ((int)(no_plate)) % 2 == 0: print '\n\nEVEN VEHICLE NO\n\n' else: