From 92efbd87c24f6bf081b92dbd4c885d483249d8e2 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Tue, 2 Jan 2018 14:19:22 +0100 Subject: [PATCH] - moved the additions into the lib folder - created an update script - changed git settings --- .idea/dictionaries/Trive.xml | 10 ---------- .idea/für Robotototo.iml | 12 ------------ .idea/misc.xml | 19 ------------------- gyro.py => lib/gyro.py | 0 gyro_test.py => lib/gyro_test.py | 2 +- motor.py => lib/motor.py | 0 motors.py => lib/motors.py | 0 servo_2.py => lib/servo_2.py | 0 thermo.py => lib/thermo.py | 0 ultrasonic.py => lib/ultrasonic.py | 0 lib/ultrasonic_test.py | 7 +++++++ main.py | 12 +++++++----- ultrasonic_test.py | 6 ------ update.sh | 13 +++++++++++++ 14 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 .idea/dictionaries/Trive.xml delete mode 100644 .idea/für Robotototo.iml delete mode 100644 .idea/misc.xml rename gyro.py => lib/gyro.py (100%) rename gyro_test.py => lib/gyro_test.py (78%) rename motor.py => lib/motor.py (100%) rename motors.py => lib/motors.py (100%) rename servo_2.py => lib/servo_2.py (100%) rename thermo.py => lib/thermo.py (100%) rename ultrasonic.py => lib/ultrasonic.py (100%) create mode 100644 lib/ultrasonic_test.py delete mode 100644 ultrasonic_test.py create mode 100644 update.sh diff --git a/.idea/dictionaries/Trive.xml b/.idea/dictionaries/Trive.xml deleted file mode 100644 index 1c38218..0000000 --- a/.idea/dictionaries/Trive.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - adafruit - pygame - smbus - sudo - - - \ No newline at end of file diff --git a/.idea/für Robotototo.iml b/.idea/für Robotototo.iml deleted file mode 100644 index 1d3bd13..0000000 --- a/.idea/für Robotototo.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 4f4d2c4..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/gyro.py b/lib/gyro.py similarity index 100% rename from gyro.py rename to lib/gyro.py diff --git a/gyro_test.py b/lib/gyro_test.py similarity index 78% rename from gyro_test.py rename to lib/gyro_test.py index 068a375..22c5f66 100644 --- a/gyro_test.py +++ b/lib/gyro_test.py @@ -1,4 +1,4 @@ -import gyro +from lib import gyro import time while True: print(gyro.getAllOut()['rot']) diff --git a/motor.py b/lib/motor.py similarity index 100% rename from motor.py rename to lib/motor.py diff --git a/motors.py b/lib/motors.py similarity index 100% rename from motors.py rename to lib/motors.py diff --git a/servo_2.py b/lib/servo_2.py similarity index 100% rename from servo_2.py rename to lib/servo_2.py diff --git a/thermo.py b/lib/thermo.py similarity index 100% rename from thermo.py rename to lib/thermo.py diff --git a/ultrasonic.py b/lib/ultrasonic.py similarity index 100% rename from ultrasonic.py rename to lib/ultrasonic.py diff --git a/lib/ultrasonic_test.py b/lib/ultrasonic_test.py new file mode 100644 index 0000000..3d8df4f --- /dev/null +++ b/lib/ultrasonic_test.py @@ -0,0 +1,7 @@ +from lib import ultrasonic + +sensor= ultrasonic.Sensor() +sensor.init(11,7) +print('Beginn der Messung') +print(sensor.echo()) +sensor.clean() \ No newline at end of file diff --git a/main.py b/main.py index 46ef9b2..01814c8 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ -import pygame, picamera, ultrasonic#,gyro +import pygame, picamera #,gyro +from lib import ultrasonic from datetime import datetime from subprocess import call import RPi.GPIO as GPIO @@ -9,7 +10,7 @@ import RPi.GPIO as GPIO BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) # --ultrasonic-- -sensor=ultrasonic.Sensor() +sensor= ultrasonic.Sensor() sensor.init(11,7) # -- Nightmode # WHITE, BLACK=BLACK,WHITE @@ -71,17 +72,17 @@ def reset_dire(): def drive_left(): if not left: - call(['python', 'servo_2.py','left']) + call(['python', './lib/servo_2.py','left']) return def drive_right(): if not right: - call(['python', 'servo_2.py','right']) + call(['python', './lib/servo_2.py','right']) return def reset_turn(): if left or right: - call(['python','servo_2.py']) + call(['python','./lib/servo_2.py']) return # ____________________________ # -- special functions @@ -108,6 +109,7 @@ def turn_rec(*record): def imgRefresh(): #turn_rec(True) + image = None try: image = pygame.image.load('image.jpg') image = pygame.transform.scale(image, (192*2, 108*2)) diff --git a/ultrasonic_test.py b/ultrasonic_test.py deleted file mode 100644 index 4f210db..0000000 --- a/ultrasonic_test.py +++ /dev/null @@ -1,6 +0,0 @@ -import ultrasonic -sensor=ultrasonic.Sensor() -sensor.init(11,7) -print('Beginn der Messung') -print(sensor.echo()) -sensor.clean() \ No newline at end of file diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..fb4ab47 --- /dev/null +++ b/update.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +cd .. +if [ -d "spydian/" ];then + sudo git clone https://bitbucket.org/trivernis/spydian.git spydian_update + sudo rsync -a ./spydian_update/ ./spydian/ + sudo rm -r ./spydian_update/ + sudo chmod -R u+rw ./spydian/ + exit 0 +else + sudo git clone https://bitbucket.org/trivernis/spydian.git spydian + sudo chmod -R u+rw ./spydian/ + exit 0 +fi \ No newline at end of file