Ejemplo n.º 1
0
        print ("Test 6) Set individual segment")
        grovepi.fourDigit_segment(display,0,118) # 118 = H
        grovepi.fourDigit_segment(display,1,121) # 121 = E
        grovepi.fourDigit_segment(display,2,118) # 118 = H
        grovepi.fourDigit_segment(display,3,121) # 121 = E
        time.sleep(.5)

        grovepi.fourDigit_segment(display,0,57) # 57 = C
        grovepi.fourDigit_segment(display,1,63) # 63 = O
        grovepi.fourDigit_segment(display,2,63) # 63 = O
        grovepi.fourDigit_segment(display,3,56) # 56 = L
        time.sleep(.5)

        print ("Test 7) Set score")
        grovepi.fourDigit_score(display,0,0)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,0)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,1)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,2)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,3)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,4)
        time.sleep(.2)
        grovepi.fourDigit_score(display,1,5)
        time.sleep(.5)

        print ("Test 8) Set time")
Ejemplo n.º 2
0
		M = '%02d' % mydate.minute
		S = '%02d' % mydate.second
		t = '%02d' % temp
		h = '%02d' % hum

		V = str(sensor_value)
		R = '%02d' % resistance

		d = str(distance)

		digitalWrite(led,0)		# Send HIGH to switch on LED
                time.sleep(.1)
                digitalWrite(led,1)		# Send LOW to switch on LED
                time.sleep(.1)
                digitalWrite(led,0)		# Send HIGH to switch on LED

		#sys.stdout = open('file5', 'a+')		
		#print A," ",D," ",O," ",Y,"    ",H,":",M,":",S,"\t",temp,"\t",hum, "\t",V,"\t",R		
		#setRGB(random.randint(0,255),random.randint(0,255),random.randint(0,255))
		#setText(H + ":" + M + ":" + S + "\n" + A + " " + D + " " + O + " " + Y + " " + Z)	
		#time.sleep(5)
		setRGB(random.randint(0,255),random.randint(0,255),random.randint(0,255))
		setText("tmp " + t + "C  " + "hum " + h + "%" + "\n" + "lig " + V + "u " + "dis " + d + "u")	
		grovepi.fourDigit_score(display,a,b)
		time.sleep(.1)



	except (IOError,TypeError) as e:
		print "Error"
Ejemplo n.º 3
0
		Y = mydate.strftime("%Y")

		H = '%02d' % mydate.hour
		M = '%02d' % mydate.minute
		S = '%02d' % mydate.second
		t = str(temp)
		h = str(hum)

		sys.stdout = open('file2', 'a+')		
		print A," ",D," ",O," ",Y,"    ",H,":",M,":",S,"\t",temp,"\t",hum	

		digitalWrite(led,0)		# Send HIGH to switch on LED
                time.sleep(.1)
                digitalWrite(led,1)		# Send LOW to switch on LED
                time.sleep(.1)
                digitalWrite(led,0)		# Send HIGH to switch on LED
                
		setRGB(random.randint(0,255),random.randint(0,255),random.randint(0,255))
		setText(H + ":" + M + ":" + S + "\n" + A + " " + D + " " + O + " " + Y + " " + Z)	
		time.sleep(1)
		setRGB(random.randint(0,255),random.randint(0,255),random.randint(0,255))
		setText("Temp    : " + t + "C" + "\n" + "Humidity: " + h + "%")	
		grovepi.fourDigit_score(display1,int(float(temp)),int(float(hum)))
		grovepi.fourDigit_score(display2,mydate.hour,mydate.minute)
                time.sleep(1)



	except (IOError,TypeError) as e:
		print "Error"
Ejemplo n.º 4
0
        #grovepi.fourDigit_score(display,1,0)
        #time.sleep(.2)
        #grovepi.fourDigit_score(display,1,1)
        #time.sleep(.2)
        #grovepi.fourDigit_score(display,1,2)
        #time.sleep(.2)
        #grovepi.fourDigit_score(display,1,3)
        #time.sleep(.2)
        #grovepi.fourDigit_score(display,1,4)
        #time.sleep(.2)
        #grovepi.fourDigit_score(display,1,5)
        #time.sleep(.5)

        print("Setting time")
        current_time = datetime.datetime.now()
        grovepi.fourDigit_score(display, current_time.hour,
                                current_time.minute)
        time.sleep(1)

        #print ("Test 9) Monitor analog pin")
        #seconds = 10
        #grovepi.fourDigit_monitor(display,sensor,seconds)
        #time.sleep(.5)

        #print ("Test 10) Switch all on")
        #grovepi.fourDigit_on(display)
        #time.sleep(.5)

        #print ("Test 11) Switch all off")
        #grovepi.fourDigit_off(display)
        #time.sleep(.5)
Ejemplo n.º 5
0
        intHour = mydate.hour
        intMin = mydate.minute

        intTemp = int(float(temp))
        intHum = int(float(hum))

    except (IOError, TypeError, ValueError) as e:
        print "Error"

    else:
        sys.stdout = open('file2', 'a+')
        print A, " ", D, " ", O, " ", Y, "    ", H, ":", M, ":", S, "\t", temp, "\t", hum

        digitalWrite(led, 0)  # Send HIGH to switch on LED
        time.sleep(.1)
        digitalWrite(led, 1)  # Send LOW to switch on LED
        time.sleep(.1)
        digitalWrite(led, 0)  # Send HIGH to switch on LED

        setRGB(random.randint(0, 255), random.randint(0, 255),
               random.randint(0, 255))
        setText(H + ":" + M + ":" + S + "\n" + A + " " + D + " " + O + " " +
                Y + " " + Z)
        time.sleep(1)
        setRGB(random.randint(0, 255), random.randint(0, 255),
               random.randint(0, 255))
        setText("Temp    : " + t + "C" + "\n" + "Humidity: " + h + "%")
        grovepi.fourDigit_score(display1, intTemp, intHum)
        grovepi.fourDigit_score(display2, intHour, intMin)
        time.sleep(1)
    def setScore(self, left_score=0, right_score=0):
        """
		display score , i.e two 2 digit values separated by :
		by default display 00:00
		"""
        grovepi.fourDigit_score(self.display, left_score, right_score)
Ejemplo n.º 7
0
 def setScore(self, left, right):
     print("set score ", left, ":", right)
     grovepi.fourDigit_score(self.port, left, right)
     return
Ejemplo n.º 8
0
        H = '%02d' % mydate.hour
        M = '%02d' % mydate.minute
        S = '%02d' % mydate.second
        t = str(temp)
        h = str(hum)

        sys.stdout = open('file2', 'a+')
        print A, " ", D, " ", O, " ", Y, "    ", H, ":", M, ":", S, "\t", temp, "\t", hum

        digitalWrite(led, 0)  # Send HIGH to switch on LED
        time.sleep(.1)
        digitalWrite(led, 1)  # Send LOW to switch on LED
        time.sleep(.1)
        digitalWrite(led, 0)  # Send HIGH to switch on LED

        setRGB(random.randint(0, 255), random.randint(0, 255),
               random.randint(0, 255))
        setText(H + ":" + M + ":" + S + "\n" + A + " " + D + " " + O + " " +
                Y + " " + Z)
        time.sleep(1)
        setRGB(random.randint(0, 255), random.randint(0, 255),
               random.randint(0, 255))
        setText("Temp    : " + t + "C" + "\n" + "Humidity: " + h + "%")
        grovepi.fourDigit_score(display1, int(float(temp)), int(float(hum)))
        grovepi.fourDigit_score(display2, mydate.hour, mydate.minute)
        time.sleep(1)

    except (IOError, TypeError) as e:
        print "Error"