コード例 #1
0
ファイル: easygopigo.py プロジェクト: CleoQc/PythonGoBox
    def __init__(self, port):
        global IR_RECEIVER_ENABLED

        if ir_receiver_check.check_ir() == 0:
            print("*** Error with the Remote Controller")
            print("Please enable the IR Receiver in the Advanced Comms tool")
            IR_RECEIVER_ENABLED = False
        else:
            Sensor.__init__(self, port, "SERIAL")
            self.set_descriptor("Remote Control")
コード例 #2
0
ファイル: ir_gui.py プロジェクト: CleoQc/GoBox
	def test_ir_receiver(self, event):
		dlg = wx.MessageDialog(self, 'Click OK to begin testing IR receiver.', 'Begin Check', wx.OK|wx.ICON_INFORMATION)
		dlg.ShowModal()
		dlg.Destroy()

		check=ir_receiver_check.check_ir()
		# send_bash_command('sudo python /home/pi/Desktop/GoPiGo/Software/Python/other_scripts/demo.py')
		if check:
			dlg = wx.MessageDialog(self, 'IR receiver is enabled', 'Enable', wx.OK|wx.ICON_INFORMATION)
		else:
			dlg = wx.MessageDialog(self, 'IR receiver is disabled', 'Disable', wx.OK|wx.ICON_INFORMATION)
		dlg.ShowModal()
		dlg.Destroy()
コード例 #3
0
ファイル: ir_gui.py プロジェクト: vh2225/Raspbian_For_Robots
    def test_ir_receiver(self, event):
        dlg = wx.MessageDialog(self, 'Click OK to begin testing IR receiver.',
                               'Begin Check', wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

        check = ir_receiver_check.check_ir()
        # send_bash_command('sudo python /home/pi/Desktop/GoPiGo/Software/Python/other_scripts/demo.py')
        if check:
            dlg = wx.MessageDialog(self, 'IR receiver is enabled', 'Enable',
                                   wx.OK | wx.ICON_INFORMATION)
        else:
            dlg = wx.MessageDialog(self, 'IR receiver is disabled', 'Disable',
                                   wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
コード例 #4
0
    def __init__(self, port="SERIAL"):
        global IR_RECEIVER_ENABLED
        # IR Receiver
        try:
            import ir_receiver
            import ir_receiver_check
            IR_RECEIVER_ENABLED = True
        except:
            IR_RECEIVER_ENABLED = False

        if ir_receiver_check.check_ir() == 0:
            print("*** Error with the Remote Controller")
            print("Please enable the IR Receiver in the Advanced Comms tool")
            IR_RECEIVER_ENABLED = False
        else:
            Sensor.__init__(self, port, "SERIAL")
            self.set_descriptor("Remote Control")
コード例 #5
0
def find_brickpi():
    '''
    boolean function that detects the presence of a BrickPi+
    returns True or False
    using try/except in case the BrickPi library is not found. Return False
    '''
    debug_print("Detecting BrickPi+")
    try:
        import ir_receiver_check
        if ir_receiver_check.check_ir():
            return False
        else:
            import BrickPi
            BrickPi.BrickPiSetup()
            #if BrickPiSetupSensors() == 0: # really slow
            if BrickPi.BrickPiUpdateValues() == 0:
                return True
            else:
                return False
    except:
        return False
コード例 #6
0
# John      6/17/2016		Add some comments.
# 			                                                         
# These files have been made available online through a Creative Commons Attribution-ShareAlike 3.0  license.
# (http://creativecommons.org/licenses/by-sa/3.0/)           
#
########################################################################

import serial, time
import smbus
import math
import RPi.GPIO as GPIO
import struct
import sys
import ir_receiver_check

if ir_receiver_check.check_ir():
	print("Disable IR receiver before continuing")
	exit()

ser = serial.Serial('/dev/ttyAMA0',  9600, timeout = 0)	#Open the serial port at 9600 baud
ser.flush()

def readlineCR():
    rv = ""
    while True:
        time.sleep(0.01)	# This is the critical part.  A small pause 
        					# works really well here.
        ch = ser.read()        
        rv += ch
        if ch=='\r' or ch=='':
            return rv
コード例 #7
0
# Karan      21 Aug 14 		Initial Authoring
# Karan		 10 June 15		Updated the code to reflect the decimal GPS coordinates (contributed by rschmidt on the DI forums: http://www.dexterindustries.com/forum/?topic=gps-example-questions/#post-5668)
# Karan		 18 Mar 16		Updated code to handle conditions where no fix from satellite

import serial, time
import smbus
import math
import RPi.GPIO as GPIO
import struct
import sys
import ir_receiver_check

enable_debug=1
enable_save_to_file=0

if ir_receiver_check.check_ir():
	print "Disable IR receiver before continuing"
	exit()
	
ser = serial.Serial('/dev/ttyAMA0',  9600, timeout = 0)	#Open the serial port at 9600 baud
ser.flush()

class GPS:
	#The GPS module used is a Grove GPS module http://www.seeedstudio.com/depot/Grove-GPS-p-959.html
	inp=[]
	# Refer to SIM28 NMEA spec file http://www.seeedstudio.com/wiki/images/a/a0/SIM28_DATA_File.zip
	GGA=[]

	#Read data from the GPS
	def read(self):	
		while True: