Merge branch 'develop' of https://kitsunehosting.net/gitea/Kenwood/lewis-crawler into develop
This commit is contained in:
18
crawler_software/raspberry_pi/Makefile
Normal file
18
crawler_software/raspberry_pi/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
# A makefile for installing the robot's python
|
||||
# software and setting it up.
|
||||
#
|
||||
# Requires sudo
|
||||
#
|
||||
# Kitsune Scientific 2021
|
||||
|
||||
all: install
|
||||
|
||||
upload: crawler.service
|
||||
sudo cp crawler.service /etc/systemd/system/crawler.service
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
sudo systemctl enable crawler.service
|
||||
sudo systemctl start crawler.service
|
||||
|
||||
sudo systemctl status crawler
|
||||
11
crawler_software/raspberry_pi/crawler.service
Normal file
11
crawler_software/raspberry_pi/crawler.service
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Crawler service overseer, manages running main crawler software
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/python /srv/crawler/crawler.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,2 +1,2 @@
|
||||
PySSTV
|
||||
picamera
|
||||
picamera
|
||||
|
||||
@@ -5,18 +5,30 @@ from gps import *
|
||||
from smbus import SMBus
|
||||
import time
|
||||
|
||||
addr = 0x8 # bus address
|
||||
addr = 0x4 # bus address
|
||||
bus = SMBus(1) # indicates /dev/ic2-1
|
||||
|
||||
numb = 1
|
||||
|
||||
def writeData(value):
|
||||
byteValue = StringToBytes(value)
|
||||
bus.write_i2c_block_data(addr,0x00,byteValue) #first byte is 0=command byte.. just is.
|
||||
return -1
|
||||
|
||||
|
||||
def StringToBytes(val):
|
||||
retVal = []
|
||||
for c in val:
|
||||
retVal.append(ord(c))
|
||||
return retVal
|
||||
|
||||
try:
|
||||
for _x in range (0, 2):
|
||||
for i in range(70, 130):
|
||||
bus.write_byte(addr, i)
|
||||
for i in range(78, 130):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 70, -1):
|
||||
bus.write_byte(addr, i)
|
||||
for i in range(130, 78, -1):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
except OSError:
|
||||
print("Could not speak to ardujmemo")
|
||||
|
||||
20
crawler_software/raspberry_pi/tests/stack_overflow.py
Normal file
20
crawler_software/raspberry_pi/tests/stack_overflow.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import smbus
|
||||
import time
|
||||
import struct
|
||||
|
||||
# for RPI version 1, use bus = smbus.SMBus(0)
|
||||
bus = smbus.SMBus(1)
|
||||
|
||||
# This is the address we setup in the Arduino Program
|
||||
address = 0x04
|
||||
|
||||
try:
|
||||
for _x in range (0, 2):
|
||||
for i in range(78, 130):
|
||||
bus.write_i2c_block_data(address, 0, [1, i])
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 78, -1):
|
||||
bus.write_i2c_block_data(address, 0, [1, i])
|
||||
time.sleep(0.02)
|
||||
except OSError:
|
||||
print("Could not speak to ardujmemo")
|
||||
Reference in New Issue
Block a user