def __new__(self): if self._instance is None: self._instance = super(Main, self).__new__(self) self._motor_control = MotorControl() # print(self._motor_control) self._lcd = LCD() self._lcd.start() self._temperature = temperature() self._light = light() self._distance = Distance() self._compass = compass(declination=(1, 19)) return self._instance
def writeTemperature(): dt = datetime.now() t = temperature() with open("temperature.csv", "a") as tFile: tFile.write('{0},{1}\n'.format(dt,t))
# Créé par macveighjp, le 06/08/2014 import ew import temperature print ew(15.) print temperature(17.05)
message(t, dt) # Solve for predicted phi (a, L) = composition(mesh, Constant(dt), u_, phi_) eq = VariationalProblem(a, L, bc) eq.parameters["solver"]["linear_solver"] = "gmres" eq.solve(phi_pr) # Filter predicted phi filterProp(phi_pr) print "Sum of densities = ", sum(phi_pr.vector().array()) # Solve for predicted temperature (a, L) = temperature(mesh, Constant(dt), u_, T_) eq = VariationalProblem(a, L, T_bcs) eq.parameters["solver"]["linear_solver"] = "gmres" eq.solve(T_pr) # Solve for predicted velocity H = Ra*T_pr - Rb*phi_pr eta = eta0 * exp(-b_val*T_pr/deltaT + c_val*(1.0 - triangle.x[1])/height ) (a, L, precond) = momentum(mesh, eta, g, H) (A, b) = assemble_system(a, L, bcs) solver.set_operators(A, P) t1 = time.time() solver.solve(velocity_pressure.vector(), b) t2 = time.time() print "Krylov solve took ", (t2 - t1) #solve(A, velocity_pressure.vector(), b)
music.play(music.JUMP_UP) display.show('B', color=(20, 0, 0)) while 0 == button_b.was_pressed(): time.sleep(0.1) time.sleep(0.5) display.show('O', color=(0, 20, 0)) music.play(music.JUMP_UP) display.show('T', color=(20, 0, 0)) import temperature __adc = machine.ADC(machine.Pin(35, machine.Pin.IN)) __adc.atten(machine.ADC.ATTN_11DB) temperature = temperature.Temperature(__adc).temperature time.sleep(1) while temperature() < 10: time.sleep(1) display.show('O', color=(0, 20, 0)) music.play(music.JUMP_UP) display.show('9', color=(20, 0, 0)) __i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21), freq=200000) while True: __dev = __i2c.scan() if len(__dev) > 0: buf = bytearray(1) while buf[0] != 234: __i2c.readfrom_mem_into(__dev[0], 0, buf) time.sleep(1) # print(buf[0]) break
def currentTemperature(): return str(temperature())