#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import Proximity
import time

wiringdata.initIO()
mod0 = milMod.milMod(Proximity.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:

        print "Check with white paper. Detecting distance is under 5mm."

        #initiarize power ON. You can control LED power of proximity sensor.
        Proximity.holdConnect(
            mod0)  # We highly recomend to use this function for Proximity.
        Proximity.power(mod0, 1)  #power ON
        time.sleep(0.5)  #worm up
        Proximity.holdDisconnect(
            mod0)  # We highly recomend to use this function for Proximity.

        while (1):
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import DCMotor
import time

wiringdata.initIO()
mod0 = milMod.milMod(DCMotor.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:
        print "BD6211 voltage:3 ~ 7V   max current:1.0A."
        print "Do not add high voltage to motor. Examine the current, maximum 1.0A."
        while (1):
            mod0.connect()
            DCMotor.turnMotor(mod0, 1, 0)
            time.sleep(1)
            DCMotor.turnMotor(mod0, 1, 1)
            time.sleep(1)
            DCMotor.turnMotor(mod0, 0, 1)
            time.sleep(1)
            DCMotor.turnMotor(mod0, 1, 1)
            time.sleep(1)
#Please,set IOs
#IOdata = [p.outpin[0],p.outpin[1],p.outpin[2],p.outpin[3]]
#in wiringdata.py

from milpy import mil
from milpy import milMod
from milpy import wiringdata

from milpy import gpio

import time

#set up for GPIO device
wiringdata.initIO()
modA = milMod.milMod(gpio.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:
        print "Please,set IOs"
        print "IOdata = [p.outpin[0],p.outpin[1],p.outpin[2],p.outpin[3]]"
        print "in wiringdata.py"

        #GPIO OUT test
        while (1):
            modA.connect()
            gpio.DigitalOut(modA, 0, 1)
            gpio.DigitalOut(modA, 1, 0)
            gpio.DigitalOut(modA, 2, 0)
            gpio.DigitalOut(modA, 3, 0)
            time.sleep(0.1)
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import PIR
import time

wiringdata.initIO()
mod0 = milMod.milMod(PIR.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:

        while (1):
            mod0.connect()

            readData = PIR.read(mod0)

            print "read data = ", readData

            mod0.disconnect()

            time.sleep(0.1)
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import LightSensor
import time

wiringdata.initIO()
modA = milMod.milMod(LightSensor.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:
        while (1):
            modA.connect()
            #please, ignore the 1st data.
            readData = LightSensor.read(modA)
            print "readData = ", readData
            time.sleep(1)
            modA.disconnect()

    except KeyboardInterrupt:
        print("detect key interrupt [ctrl]+ [C] \n")

    mil.cleanup()
Esempio n. 6
0
from milpy import wiringdata
from milpy import Accelerometer
from milpy import AirPressure
from milpy import Humidity
from milpy import LightSensor
from milpy import Pwm
from milpy import StepUni
import time
import os
os.popen("sudo chmod 666 /sys/module/i2c_bcm2708/parameters/combined",
         'w').write("kikaika")
os.popen("sudo echo -n 1 >  /sys/module/i2c_bcm2708/parameters/combined",
         'w').write("kikaika")

wiringdata.initIO()
modA = milMod.milMod(Accelerometer.getInfo(0))
modB = milMod.milMod(AirPressure.getInfo(3))
modC = milMod.milMod(Humidity.getInfo(1))
modD = milMod.milMod(LightSensor.getInfo(2))
modA = milMod.milMod(Pwm.getInfo(1))

mod0 = milMod.milMod(StepUni.getInfo(0))
mod1 = milMod.milMod(StepUni.getInfo(1))

if __name__ == '__main__':
    try:
        print "If you want to use this library, you need these command before runninng."
        print "$sudo chmod 666 /sys/module/i2c_bcm2708/parameters/combined,"
        print "$sudo echo -n 1 >  /sys/module/i2c_bcm2708/parameters/combined."

        ID = Accelerometer.init()
Esempio n. 7
0
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python

from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import Humidity
import time

wiringdata.initIO()
modA = milMod.milMod(Humidity.getInfo(0))	#Baseboard connector No.0
		
if __name__=='__main__':
	try:
		Humidity.init()

		#modA.connect()#I2C devices not need connect command
		
		while(1):
			Temp = Humidity.readTemp()
			print "Temparature = " , Temp[0] , "raw Data = ", hex(Temp[1])
			Humid = Humidity.readHumidity()
			print "Humidity = " , Humid[0] , "raw Data = ", hex(Humid[1])
			time.sleep(1)

	except KeyboardInterrupt:
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import Moisuture
import time

wiringdata.initIO()
modA = milMod.milMod(Moisuture.getInfo(0))
		
if __name__=='__main__':
	try:
		
		while(1):
			modA.connect()
			readData = Moisuture.read(modA)
			print "readData = ",readData
			time.sleep(1)
			modA.disconnect()

	except KeyboardInterrupt:
		print("detect key interrupt [ctrl]+ [C] \n")

	mil.cleanup()
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import Relay
import time

wiringdata.initIO()
mod0 = milMod.milMod(Relay.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:
        while (1):
            #mod0.connect()
            Relay.holdConnect(
                mod0)  # We highly recomend to use this function for relay.
            time.sleep(2)
            print "power ON"
            Relay.power(mod0, 1)
            time.sleep(2)
            #mod0.disconnect()
            Relay.holdDisconnect(
                mod0)  # We highly recomend to use this function for relay.
            time.sleep(2)
Esempio n. 10
0
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import AirPressure
import time

wiringdata.initIO()
modA = milMod.milMod(AirPressure.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:

        #modA.connect() #I2C device do not need "connect()" and "disconnect()"

        while (1):
            data = AirPressure.getCalibData()
            TAndP = AirPressure.read(data)
            print "T = ", TAndP[0], "deg"
            print "P = ", TAndP[1], "hPa"
            print "Altitude = ", TAndP[2], "m"  #you need calibration.
            time.sleep(1)

    except KeyboardInterrupt:
#  $sudo chmod 666 /sys/module/i2c_bcm2708/parameters/combined
#  $sudo echo -n 1 >  /sys/module/i2c_bcm2708/parameters/combined
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import Accelerometer
import time

wiringdata.initIO()
modA = milMod.milMod(Accelerometer.getInfo(0))

if __name__ == '__main__':
    try:
        print "If you want to use this library, you need these command before runninng."
        print "$sudo chmod 666 /sys/module/i2c_bcm2708/parameters/combined,"
        print "$sudo echo -n 1 >  /sys/module/i2c_bcm2708/parameters/combined."

        ID = Accelerometer.init()
        print "ID = ", ID

        #modA.connect() #I2C device do not need "connect()" and "disconnect()"

        while (1):
            accX = Accelerometer.get_X()
            print "X = ", accX
#!/usr/bin/python

#Please,set IOs 
#IOdata = [p.outpin[0],p.outpin[1],p.outpin[2],p.outpin[3]]
#in wiringdata.py

from milpy import mil
from milpy import milMod
from milpy import wiringdata
import time

#set up for GPIO device
wiringdata.initIO()
datas1 = [0x8000,0x0001]
datas1.extend(wiringdata.getWiring(0x80000001))
modA = milMod.milMod(datas1)

#digital out function
def myDout(milModClass, pinNo, HighLow):
	wiringdata.IOout(milModClass.pinData[pinNo],HighLow)

#digital in function
def myDin(milModClass, pinNo):
	return wiringdata.IOin(milModClass.pinData[pinNo])
	
if __name__=='__main__':
	try:
		print "Please,set IOs"
		print "IOdata = [p.outpin[0],p.outpin[1],p.outpin[2],p.outpin[3]]"
		print "in wiringdata.py"
		
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import DistanceUSonic
import time

wiringdata.initIO()
mod0 = milMod.milMod(DistanceUSonic.getInfo(0))  #Baseboard connector No.0

if __name__ == '__main__':
    try:
        mod0.connect()
        while (1):

            returnData = DistanceUSonic.read(mod0)

            print "Distance: ", returnData

            #mod0.disconnect()
            time.sleep(0.1)

    except KeyboardInterrupt:
        print("detect key interrupt [ctrl]+ [C] \n")
Esempio n. 14
0
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python

from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import StepUni
import time

wiringdata.initIO()
mod0 = milMod.milMod(StepUni.getInfo(0))
mod1 = milMod.milMod(StepUni.getInfo(1))
#print StepUni.getInfo(0)
		
if __name__=='__main__':
	try:
		
		while(1):
			print"try connect"
			mod0.connect()
			StepUni.stopStep(mod0)
			print "try move"
			StepUni.moveStep(mod0,True, 100,0.003)	# 100 steps, delay time 0.003sec (We tested chinese stepping motor ST-42BYG0506H) 
			StepUni.moveStep(mod0,False, 100,0.003)	# 100 steps, delay time 0.003sec (We tested chinese stepping motor ST-42BYG0506H) 
			StepUni.stopStep(mod0)
			mod0.disconnect()
Esempio n. 15
0
#	web site: http://www.milletool.com/
#	Date	:	8/OCT/2016
#
########################################################################
#Revision Information
#
########################################################################
#!/usr/bin/python
from milpy import mil
from milpy import milMod
from milpy import wiringdata
from milpy import DA1ch
import time

wiringdata.initIO()
modA = milMod.milMod(DA1ch.getInfo(0))	#Baseboard connector No.0

if __name__=='__main__':
	try:
		while(1):
			modA.connect()
			returnData = DA1ch.write(modA,0xfff)	#MAX Voltaga
			print "DA = 0xfff"
			time.sleep(1)
			returnData = DA1ch.write(modA,0x000)	#MIN Voltaga
			print "DA = 0x000"
			modA.disconnect()
			time.sleep(1)

	except KeyboardInterrupt:
		print("detect key interrupt [ctrl]+ [C] \n")