Fixup all local
This commit is contained in:
parent
5e749906a3
commit
95efff98ce
|
@ -10,3 +10,6 @@ __pycache__
|
|||
*.jpg
|
||||
*.wav
|
||||
*.pdf
|
||||
|
||||
# Dev
|
||||
.vscode
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
### DISCLAIMER
|
||||
### This is an example Makefile and it MUST be configured to suit your needs.
|
||||
### For detailed explanations about all the available options,
|
||||
### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
|
||||
|
||||
### PROJECT_DIR
|
||||
### This is the path to where you have created/cloned your project
|
||||
PROJECT_DIR = $(shell dirname $(shell pwd))
|
||||
|
||||
### ARDMK_DIR
|
||||
### Path to the Arduino-Makefile directory.
|
||||
ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
|
||||
|
||||
### ARDUINO_DIR
|
||||
### Path to the Arduino application and resources directory.
|
||||
ARDUINO_DIR = /usr/share/arduino
|
||||
|
||||
### USER_LIB_PATH
|
||||
### Path to where the your project's libraries are stored.
|
||||
USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
|
||||
|
||||
### BOARD_TAG & BOARD_SUB
|
||||
### For Arduino IDE 1.0.x
|
||||
### Only BOARD_TAG is needed. It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
|
||||
# BOARD_TAG = mega2560
|
||||
### For Arduino IDE 1.6.x
|
||||
### Both BOARD_TAG and BOARD_SUB are needed. They must be set to the board you are currently using. (i.e BOARD_TAG = uno, mega, etc. & BOARD_SUB = atmega2560, etc.)
|
||||
### Note: for the Arduino Uno, only BOARD_TAG is mandatory and BOARD_SUB can be equal to anything
|
||||
BOARD_TAG = mega
|
||||
BOARD_SUB = atmega2560
|
||||
|
||||
### MONITOR_PORT
|
||||
### The port your board is connected to. Using an '*' tries all the ports and finds the right one. Choose one of the two.
|
||||
MONITOR_PORT = /dev/ttyUSB*
|
||||
# MONITOR_PORT = /dev/ttyACM*
|
||||
|
||||
### MONITOR_BAUDRATE
|
||||
### It must be set to Serial baudrate value you are using.
|
||||
MONITOR_BAUDRATE = 115200
|
||||
|
||||
### AVR_TOOLS_DIR
|
||||
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
|
||||
AVR_TOOLS_DIR = /usr
|
||||
|
||||
### AVRDUDE
|
||||
### Path to avrdude directory.
|
||||
AVRDUDE = /usr/bin/avrdude
|
||||
|
||||
### CFLAGS_STD
|
||||
CFLAGS_STD = -std=gnu11
|
||||
|
||||
### CXXFLAGS_STD
|
||||
### You can choose wich ever you like
|
||||
# CXXFLAGS_STD = -std=gnu++11
|
||||
CXXFLAGS_STD = -std=gnu++17
|
||||
|
||||
|
||||
### CPPFLAGS
|
||||
### Flags you might want to set for debugging purpose. Comment to stop.
|
||||
CXXFLAGS += -pedantic -Wall -Wextra
|
||||
LDFLAGS += -fdiagnostics-color
|
||||
|
||||
### OBJDIR
|
||||
### Don't touch this!
|
||||
### This is were you put the binaries you just compile using 'make'
|
||||
CURRENT_DIR = $(shell basename $(CURDIR))
|
||||
OBJDIR = $(PROJECT_DIR)/build/$(CURRENT_DIR)/$(BOARD_TAG)
|
||||
|
||||
### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
|
@ -1,63 +0,0 @@
|
|||
/* Crawler Slave
|
||||
*
|
||||
* This code runs on the crawler i2c network
|
||||
* and provides a cleaner, less CPU intensive control over PWM devices.
|
||||
*/
|
||||
|
||||
#include <Wire.h>
|
||||
#include <Servo.h>
|
||||
|
||||
// This servo is used to wipe and clean the camera lens
|
||||
Servo windowWiperServo;
|
||||
|
||||
// Variables populated over i2c from master
|
||||
int id;
|
||||
int val;
|
||||
|
||||
void setup() {
|
||||
// For debugging
|
||||
//Serial.begin(115200);
|
||||
|
||||
// Attach the wiper servo to pin 9
|
||||
windowWiperServo.attach(9);
|
||||
|
||||
// This is the address the pi will speak to us at
|
||||
Wire.begin(0x4);
|
||||
|
||||
// Call receiveEvent when data received
|
||||
Wire.onReceive(receiveEvent);
|
||||
|
||||
// Setup LED
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
//Serial.println("Started");
|
||||
}
|
||||
|
||||
// Just loop to keep the running code alive, and wait for events to happen.
|
||||
void loop() {
|
||||
delay(50);
|
||||
}
|
||||
|
||||
// This method runs when we receive a message
|
||||
void receiveEvent(int n) {
|
||||
Wire.read(); // Remove smbus trash
|
||||
if (true) { // Dont do anything if this is not true
|
||||
id = Wire.read(); // ID of the servo/device to access
|
||||
val = Wire.read(); // Value to assign
|
||||
|
||||
//Serial.println(id);
|
||||
//Serial.println(val);
|
||||
|
||||
switch(id) {
|
||||
case 1:
|
||||
windowWiperServo.write(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevents a bug where if bytes are left in buffer, arduino crashes.
|
||||
while (Wire.available()) {
|
||||
Wire.read();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
pysstv = "*"
|
||||
pillow = "*"
|
||||
pyaudio = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.10"
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "7bbd77142530386cfe68298f015a940e79c9deda573da2c6cc9324c06a742580"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.10"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"pillow": {
|
||||
"hashes": [
|
||||
"sha256:011233e0c42a4a7836498e98c1acf5e744c96a67dd5032a6f666cc1fb97eab97",
|
||||
"sha256:0f29d831e2151e0b7b39981756d201f7108d3d215896212ffe2e992d06bfe049",
|
||||
"sha256:12875d118f21cf35604176872447cdb57b07126750a33748bac15e77f90f1f9c",
|
||||
"sha256:14d4b1341ac07ae07eb2cc682f459bec932a380c3b122f5540432d8977e64eae",
|
||||
"sha256:1c3c33ac69cf059bbb9d1a71eeaba76781b450bc307e2291f8a4764d779a6b28",
|
||||
"sha256:1d19397351f73a88904ad1aee421e800fe4bbcd1aeee6435fb62d0a05ccd1030",
|
||||
"sha256:253e8a302a96df6927310a9d44e6103055e8fb96a6822f8b7f514bb7ef77de56",
|
||||
"sha256:2632d0f846b7c7600edf53c48f8f9f1e13e62f66a6dbc15191029d950bfed976",
|
||||
"sha256:335ace1a22325395c4ea88e00ba3dc89ca029bd66bd5a3c382d53e44f0ccd77e",
|
||||
"sha256:413ce0bbf9fc6278b2d63309dfeefe452835e1c78398efb431bab0672fe9274e",
|
||||
"sha256:5100b45a4638e3c00e4d2320d3193bdabb2d75e79793af7c3eb139e4f569f16f",
|
||||
"sha256:514ceac913076feefbeaf89771fd6febde78b0c4c1b23aaeab082c41c694e81b",
|
||||
"sha256:528a2a692c65dd5cafc130de286030af251d2ee0483a5bf50c9348aefe834e8a",
|
||||
"sha256:6295f6763749b89c994fcb6d8a7f7ce03c3992e695f89f00b741b4580b199b7e",
|
||||
"sha256:6c8bc8238a7dfdaf7a75f5ec5a663f4173f8c367e5a39f87e720495e1eed75fa",
|
||||
"sha256:718856856ba31f14f13ba885ff13874be7fefc53984d2832458f12c38205f7f7",
|
||||
"sha256:7f7609a718b177bf171ac93cea9fd2ddc0e03e84d8fa4e887bdfc39671d46b00",
|
||||
"sha256:80ca33961ced9c63358056bd08403ff866512038883e74f3a4bf88ad3eb66838",
|
||||
"sha256:80fe64a6deb6fcfdf7b8386f2cf216d329be6f2781f7d90304351811fb591360",
|
||||
"sha256:81c4b81611e3a3cb30e59b0cf05b888c675f97e3adb2c8672c3154047980726b",
|
||||
"sha256:855c583f268edde09474b081e3ddcd5cf3b20c12f26e0d434e1386cc5d318e7a",
|
||||
"sha256:9bfdb82cdfeccec50aad441afc332faf8606dfa5e8efd18a6692b5d6e79f00fd",
|
||||
"sha256:a5d24e1d674dd9d72c66ad3ea9131322819ff86250b30dc5821cbafcfa0b96b4",
|
||||
"sha256:a9f44cd7e162ac6191491d7249cceb02b8116b0f7e847ee33f739d7cb1ea1f70",
|
||||
"sha256:b5b3f092fe345c03bca1e0b687dfbb39364b21ebb8ba90e3fa707374b7915204",
|
||||
"sha256:b9618823bd237c0d2575283f2939655f54d51b4527ec3972907a927acbcc5bfc",
|
||||
"sha256:cef9c85ccbe9bee00909758936ea841ef12035296c748aaceee535969e27d31b",
|
||||
"sha256:d21237d0cd37acded35154e29aec853e945950321dd2ffd1a7d86fe686814669",
|
||||
"sha256:d3c5c79ab7dfce6d88f1ba639b77e77a17ea33a01b07b99840d6ed08031cb2a7",
|
||||
"sha256:d9d7942b624b04b895cb95af03a23407f17646815495ce4547f0e60e0b06f58e",
|
||||
"sha256:db6d9fac65bd08cea7f3540b899977c6dee9edad959fa4eaf305940d9cbd861c",
|
||||
"sha256:ede5af4a2702444a832a800b8eb7f0a7a1c0eed55b644642e049c98d589e5092",
|
||||
"sha256:effb7749713d5317478bb3acb3f81d9d7c7f86726d41c1facca068a04cf5bb4c",
|
||||
"sha256:f154d173286a5d1863637a7dcd8c3437bb557520b01bddb0be0258dcb72696b5",
|
||||
"sha256:f25ed6e28ddf50de7e7ea99d7a976d6a9c415f03adcaac9c41ff6ff41b6d86ac"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==9.0.1"
|
||||
},
|
||||
"pyaudio": {
|
||||
"hashes": [
|
||||
"sha256:0d92f6a294565260a282f7c9a0b0d309fc8cc988b5ee5b50645634ab9e2da7f7",
|
||||
"sha256:259bb9c1363be895b4f9a97e320a6017dd06bc540728c1a04eb4a7b6fe75035b",
|
||||
"sha256:2a19bdb8ec1445b4f3e4b7b109e0e4cec1fd1f1ce588592aeb6db0b58d4fb3b0",
|
||||
"sha256:51b558d1b28c68437b53218279110db44f69f3f5dd3d81859f569a4a96962bdc",
|
||||
"sha256:589bfad2c615dd4b5d3757e763019c42ab82f06fba5cae64ec02fd7f5ae407ed",
|
||||
"sha256:8f89075b4844ea94dde0c951c2937581c989fabd4df09bfd3f075035f50955df",
|
||||
"sha256:93bfde30e0b64e63a46f2fd77e85c41fd51182a4a3413d9edfaf9ffaa26efb74",
|
||||
"sha256:cf1543ba50bd44ac0d0ab5c035bb9c3127eb76047ff12235149d9adf86f532b6",
|
||||
"sha256:f78d543a98b730e64621ebf7f3e2868a79ade0a373882ef51c0293455ffa8e6e"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.2.11"
|
||||
},
|
||||
"pysstv": {
|
||||
"hashes": [
|
||||
"sha256:a0306ff80bb25f28c4455c9dd75dd8cebbb3fa7d77b87af18e6cf2b86ade6b47"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.5.4"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
# KW1FOX-2 Software
|
||||
|
||||
This is the software for KW1FOX-2, the APRS/SSTV relay station.
|
|
@ -0,0 +1,29 @@
|
|||
from PIL import Image
|
||||
|
||||
from pysstv.color import Robot36
|
||||
|
||||
from tools.pyaudio import PyAudioSSTV
|
||||
|
||||
|
||||
class kw1fox2:
|
||||
def __init__(self, sim=False):
|
||||
# Lets us automate more testing locally by having a program-wide sim mode.
|
||||
self.sim = sim
|
||||
|
||||
img = Image.open("../../Resources/KW1FOX-1_320x240.png")
|
||||
self.sstv = Robot36(img, 44100, 16)
|
||||
self.sstv.vox_enabled = True
|
||||
|
||||
self.sstv.write_wav("Mysstv.wav")
|
||||
|
||||
def run(self):
|
||||
PyAudioSSTV(self.sstv).execute()
|
||||
|
||||
def take_snapshot(self):
|
||||
if not self.sim:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
station = kw1fox2()
|
||||
station.run()
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Example code from here: https://github.com/dnet/pySSTV/blob/master/pysstv/examples/pyaudio_sstv.py
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import division
|
||||
from pysstv.sstv import SSTV
|
||||
from time import sleep
|
||||
from itertools import islice
|
||||
import struct, pyaudio
|
||||
|
||||
|
||||
class PyAudioSSTV(object):
|
||||
def __init__(self, sstv):
|
||||
self.pa = pyaudio.PyAudio()
|
||||
self.sstv = sstv
|
||||
self.fmt = "<" + SSTV.BITS_TO_STRUCT[sstv.bits]
|
||||
|
||||
def __del__(self):
|
||||
self.pa.terminate()
|
||||
|
||||
def execute(self):
|
||||
self.sampler = self.sstv.gen_samples()
|
||||
stream = self.pa.open(
|
||||
format=self.pa.get_format_from_width(self.sstv.bits // 8),
|
||||
channels=1,
|
||||
rate=self.sstv.samples_per_sec,
|
||||
output=True,
|
||||
stream_callback=self.callback,
|
||||
)
|
||||
stream.start_stream()
|
||||
while stream.is_active():
|
||||
sleep(0.5)
|
||||
stream.stop_stream()
|
||||
stream.close()
|
||||
|
||||
def callback(self, in_data, frame_count, time_info, status):
|
||||
frames = "".join(
|
||||
struct.pack(self.fmt, b) for b in islice(self.sampler, frame_count)
|
||||
)
|
||||
return frames, pyaudio.paContinue
|
|
@ -1,5 +0,0 @@
|
|||
wiper_servo:
|
||||
pin: 17
|
||||
min_pulse: 0.000544
|
||||
max_pulse: 0.0024
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[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 +0,0 @@
|
|||
PySSTV
|
||||
picamera
|
|
@ -1,87 +0,0 @@
|
|||
from shutil import copyfile
|
||||
from PIL import Image, ImageFont, ImageDraw
|
||||
from pysstv import color
|
||||
|
||||
import logging as log
|
||||
|
||||
try:
|
||||
from picamera import PiCamera
|
||||
except ModuleNotFoundError:
|
||||
log.info("Running in simulator mode")
|
||||
|
||||
|
||||
def take_photo():
|
||||
# This def is meant to take a photograph from the robot,
|
||||
# it should include all steps and error checking to raise the mast
|
||||
# Take the photo, and put the mast down.
|
||||
|
||||
# Copy in the test pattern png (if photo process errors out, this will be used instead)
|
||||
log.debug('Copying test pattern.')
|
||||
copyfile('photos/TEST_PATTERN.jpg', 'working/working.jpg')
|
||||
|
||||
# Software to take the photo should be here
|
||||
#copyfile('photos/camera_latest.jpg', 'working/working.jpg')
|
||||
log.debug('Initalizing camera.')
|
||||
try:
|
||||
camera = PiCamera()
|
||||
log.info('Saving photo.')
|
||||
camera.capture('working/working.jpg')
|
||||
except NameError:
|
||||
log.info("Running in simulator mode, not replacing test pattern")
|
||||
|
||||
def mark_photo():
|
||||
log.info('Opening photo for viewing.')
|
||||
raw_img = Image.open("working/working.jpg") # Open the current working image
|
||||
log.info('Resizing image.')
|
||||
img = raw_img.resize((320, 240), Image.ANTIALIAS) # resize it for the radio
|
||||
|
||||
log.info('Drawing on image.')
|
||||
if False:
|
||||
TINT_COLOR = (255, 255, 255) # White text bg
|
||||
TEXT_COLOR = (0,0,0)
|
||||
else:
|
||||
TINT_COLOR = (0, 0, 0) # Black text bg
|
||||
TEXT_COLOR = (255,255,255)
|
||||
TRANSPARENCY = .25 # Degree of transparency, 0-100%
|
||||
OPACITY = int(255 * TRANSPARENCY)
|
||||
overlay = Image.new('RGBA', img.size, TINT_COLOR+(0,))
|
||||
|
||||
draw = ImageDraw.Draw(overlay)
|
||||
#bigfont = ImageFont.truetype(r'C:\Users\System-Pc\Desktop\arial.ttf', 20)
|
||||
#smallfont = ImageFont.truetype(r'C:\Users\System-Pc\Desktop\arial.ttf', 17)
|
||||
|
||||
draw.rectangle(((0, 0), (90, 20)), fill=TINT_COLOR+(OPACITY,))
|
||||
#draw.text((0, 0),"KW1FOX",TEXT_COLOR,font=bigfont) # Draw KW1FOX in the top left
|
||||
|
||||
draw.rectangle(((0, 40), (83, 80)), fill=TINT_COLOR+(OPACITY,))
|
||||
#draw.text((0, 40),"day: 25.2",TEXT_COLOR,font=smallfont)
|
||||
#draw.text((0, 60),"Volt: 13.8",TEXT_COLOR,font=smallfont)
|
||||
#draw.text((0, 80),"Miles: 1.02",TEXT_COLOR,font=smallfont)
|
||||
|
||||
log.info('Converting image color.')
|
||||
img = img.convert("RGBA")
|
||||
img = Image.alpha_composite(img, overlay)
|
||||
img = img.convert("RGB")
|
||||
img.save('working/working.jpg') # Save the working image
|
||||
return img
|
||||
|
||||
if __name__ == "__main__":
|
||||
log.basicConfig(level=log.DEBUG)
|
||||
|
||||
# Take photograph.
|
||||
log.info('Taking Photograph')
|
||||
take_photo() # Saves a photograph to the working/working.jpg location
|
||||
log.info('Done taking photo.')
|
||||
|
||||
# Draw neccicary text on photo
|
||||
log.info('Drawing on photo.')
|
||||
radio_photo = mark_photo() # draws text on working/working.jpg and returns a PIL image
|
||||
log.info('Done drawing on photo.')
|
||||
|
||||
log.info('Creating slowscan.')
|
||||
slowscan = color.Robot36(radio_photo, 48000, 16) # Image, rate, bits
|
||||
#slowscan = color.MartinM1(radio_photo, 48000, 16) # Image, rate, bits
|
||||
log.info('Saving out slowscan.')
|
||||
slowscan.write_wav('working/working.wav')
|
||||
|
||||
#sstv('working/working.png', 'working/radio.wav', mode='Robot36')
|
|
@ -1,73 +0,0 @@
|
|||
from discord_webhook import DiscordWebhook
|
||||
from picamera import PiCamera
|
||||
from time import sleep
|
||||
from gps import *
|
||||
from smbus import SMBus
|
||||
import time
|
||||
|
||||
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(78, 130):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 78, -1):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
except OSError:
|
||||
print("Could not speak to ardujmemo")
|
||||
|
||||
def get_uptime():
|
||||
with open('/proc/uptime', 'r') as f:
|
||||
uptime_seconds = float(f.readline().split()[0])
|
||||
|
||||
return uptime_seconds
|
||||
|
||||
def getPositionData(gps):
|
||||
location = [None]
|
||||
while(location[0] == None):
|
||||
print("Trying again")
|
||||
nx = gpsd.next()
|
||||
# For a list of all supported classes and fields refer to:
|
||||
# https://gpsd.gitlab.io/gpsd/gpsd_json.html
|
||||
if nx['class'] == 'TPV':
|
||||
latitude = getattr(nx,'lat', "Unknown")
|
||||
longitude = getattr(nx,'lon', "Unknown")
|
||||
#print "Your position: lon = " + str(longitude) + ", lat = " + str(latitude)
|
||||
location = [latitude, longitude]
|
||||
return location
|
||||
|
||||
gpsd = gps(mode=WATCH_ENABLE|WATCH_NEWSTYLE)
|
||||
|
||||
loc = getPositionData(gpsd)
|
||||
|
||||
webhookURL = "https://discord.com/api/webhooks/856609966404534272/TR9tnLq2sIGZoOeADNswmGRNlzBcqM5aKihfU6snVTP9WhSSoVVvi7nT6i-ZfZS7Hcqm"
|
||||
|
||||
print(loc[0])
|
||||
print(loc[1])
|
||||
webhook = DiscordWebhook(url=webhookURL, content="Uptime: " + str( round( ((get_uptime() / 60) / 60 ), 2 )) + " hours. Lat is " + str(loc[0]) + ", long is " + str(loc[1]))
|
||||
|
||||
camera = PiCamera()
|
||||
sleep(3) # let iso settle out
|
||||
camera.capture('still.jpg')
|
||||
|
||||
with open("still.jpg", "rb") as f:
|
||||
webhook.add_file(file=f.read(), filename='still.jpg')
|
||||
response = webhook.execute() # Hit send
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
servoPIN = 17
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(servoPIN, GPIO.OUT)
|
||||
|
||||
p = GPIO.PWM(servoPIN, 50) # GPIO 17 for PWM with 50Hz
|
||||
p.start(2.5) # Initialization
|
||||
try:
|
||||
while True:
|
||||
p.ChangeDutyCycle(10)
|
||||
time.sleep(2)
|
||||
p.ChangeDutyCycle(2.5)
|
||||
time.sleep(2)
|
||||
except KeyboardInterrupt:
|
||||
p.stop()
|
||||
GPIO.cleanup()
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
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")
|
|
@ -1,35 +0,0 @@
|
|||
# Raspberry Pi Master for Arduino Slave
|
||||
# i2c_master_pi.py
|
||||
# Connects to Arduino via I2C
|
||||
|
||||
# DroneBot Workshop 2019
|
||||
# https://dronebotworkshop.com
|
||||
|
||||
from smbus import SMBus
|
||||
import time
|
||||
|
||||
addr = 0x8 # bus address
|
||||
bus = SMBus(1) # indicates /dev/ic2-1
|
||||
|
||||
numb = 1
|
||||
|
||||
print ("Enter num")
|
||||
|
||||
for _x in range (0, 4):
|
||||
for i in range(76, 130):
|
||||
bus.write_byte(addr, i)
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 76, -1):
|
||||
bus.write_byte(addr, i)
|
||||
time.sleep(0.02)
|
||||
|
||||
#while numb == 1:
|
||||
#
|
||||
# ledstate = input(">>>> ")
|
||||
#
|
||||
# if ledstate == "1":
|
||||
# bus.write_byte(addr, 0x1) # switch it on
|
||||
# elif ledstate == "0":
|
||||
# bus.write_byte(addr, 0x0) # switch it on
|
||||
# else:
|
||||
# numb = 0
|
|
@ -1,12 +0,0 @@
|
|||
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
|
||||
from time import sleep # Import the sleep function from the time module
|
||||
|
||||
GPIO.setwarnings(False) # Ignore warning for now
|
||||
GPIO.setmode(GPIO.BOARD) # Use physical pin numbering
|
||||
GPIO.setup(12, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and set initial value to low (off)
|
||||
|
||||
while True: # Run forever
|
||||
GPIO.output(12, GPIO.HIGH) # Turn on
|
||||
sleep(1) # Sleep for 1 second
|
||||
GPIO.output(12, GPIO.LOW) # Turn off
|
||||
sleep(1) # Sleep for 1 second
|
Loading…
Reference in New Issue