Esempio n. 1
0
def main():

	#Inicialización de los módulos
	radio.init()
	sensor.init()
#	gps.init()

	while True:
		#Graba los datos a la microSD
		sensor.writeLogLine()
#		gps.writeLogLine()

		#Envía los datos por radio
		packet = bytes(sensor.line(), "utf-8")

			#Paquetiza la información para que no supere el tamaño de 60
		while len(packet) > 60:
			radio.rfm69.send(packet[:60])
			packet = packet[60:]

		if len(packet) > 0:
			radio.rfm69.send(packet)

		time.sleep(0.5)

	radio.close()
	sensor.close()
Esempio n. 2
0
def getSensorDataProcess(q):
    sensor.init()
    
    while True:
        print "Got a click - sending angle"
        data = sensor.getData()
        angle = sensor.getAngleFromData(data)
        mag,accel = data
        q.put({"angle":angle,"mag":mag, "accel":accel})
Esempio n. 3
0
def getSensorDataProcess(q):
    sensor.init()

    while True:
        print "Got a click - sending angle"
        data = sensor.getData()
        angle = sensor.getAngleFromData(data)
        mag, accel = data
        q.put({"angle": angle, "mag": mag, "accel": accel})
Esempio n. 4
0
def init():
    AntiDeathloop()
    sensor.init()
    try:
        LCD12832.init()
        LCD12832.Display_6x8_string(4, 1, "System initializing")
        init_WIFITimer()
        #Init_wifiConnect()
        print("init Process")
    except:
        pass
Esempio n. 5
0
def main():
    radio.init()
    sensor.init()

    while True:
        sensor.writeLogLine()
        packet = bytes(sensor.line(), "utf-8")
        radio.rfm69.send(packet)
        time.sleep(0.5)

    radio.close()
    sensor.close()
Esempio n. 6
0
def run():
	print("Init System")
	try:
		sensor.init()
		while True:
			print("Checking Temperature")
			humidity, temperature = sensor.check_temperature()
			timestamp = time.time()
			message = json.JSONEncoder().encode({"id": ID, "temperature": temperature, "humidity": humidity, "timestamp": timestamp})
			#Connect temporarly when sending the data overbluetooth
			send_message_once(message)
			elapsedTime = time.time() - timestamp
			timeToWait = TIME - elapsedTime if TIME - elapsedTime > 0 else 0 
			time.sleep(timeToWait)
	except KeyboardInterrupt:
		print("QUITTING")
	sensor.deinit()
Esempio n. 7
0
def dataPub(myAWSIoTMQTTClient, topic):
    #Publish bme680 sensor data to topic once
    sensorInstance = sensor.init()
    for i in range(0, 10):
        output = sensor.dataCollection(sensorInstance)
        if output:
            #!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAN NOT SET TO 1
            myAWSIoTMQTTClient.publish(topic, output, 0)
            print('Published topic %s: %s\n' % (topic, output))
            break
def dataPub(myAWSIoTMQTTClient, topic, intervalTime):
    #Publish bme680 sensor data to topic with pointed sleepTime
    sensorInstance = sensor.init()
    while True:
        output = sensor.dataCollection(sensorInstance)
        if output:
            try:
                myAWSIoTMQTTClient.publish(topic, output, 1)
                print('Published topic %s: %s\n' % (topic, output))
                print(intervalTime)
                time.sleep(intervalTime)
            except:
                time.sleep(10)
Esempio n. 9
0
import sensor
from picamera import PiCamera
import time

sensor.init()
camera = PiCamera()


camera.resolution = (1920, 1272)


while True:
	camera.capture('/home/pi/Desktop/photoTime_%0.2f.jpg' % time.time())
	time.sleep(2)
Esempio n. 10
0
'''
Author: cijliu
Date: 2020-11-23 10:14:35
LastEditTime: 2020-12-01 09:49:17
'''
import sensor

id = sensor.id.IMX307
fmt = sensor.fmt.QVGA
sensor.init(id, fmt)
ret, size, data = sensor.yuv420()
f = open("/root/app/res/image.yuv", "wb+")
f.write(data)
f.close()
sensor.destroy()
Esempio n. 11
0
def init(codeBase) :
    print "starting ", codeBase
    move.init()
    sensor.init()
    print "Initialized"