Skip to content

Instantly share code, notes, and snippets.

@RobertLucian
RobertLucian / generator.py
Created January 30, 2021 22:49
Server to receive SMS notifications from Twilio
import json
import base64
notification = {
"type": "out",
"lp": "B-36-IHK",
"c": "orange",
"b": "dodge"
}
@RobertLucian
RobertLucian / gigglebot_lidar_remote.py
Created April 8, 2019 19:16
Remote Controlled LIDAR-based GiggleBot - Remote Code
from microbit import sleep, display, button_a, button_b
import ustruct
import radio
import math
radio.on()
rotate_steps = 10
rotate_span = 160 # in degrees
rotate_step = rotate_span / rotate_steps
max_distance = 50 # in centimeters
@RobertLucian
RobertLucian / gigglebot_lidar_robot.py
Created April 8, 2019 19:04
Remote Controlled LIDAR-based GiggleBot
from gigglebot import *
from distance_sensor import DistanceSensor
from microbit import sleep
from utime import ticks_us, sleep_us
import ustruct
import radio
# stop the robot if it's already moving
stop()
# enable radio
@RobertLucian
RobertLucian / gigglebot_light_follower.py
Last active March 24, 2019 17:28
GiggleBot Light Follower w/ Proportional Controller & LPF
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
motor_speed = 100
update_rate = 70
setpoint = 0.5
Kp = 65.0
integral = 0.0
@RobertLucian
RobertLucian / gigglebot_tuned_line_follower.py
Last active March 24, 2019 17:59
GiggleBot PID Line Follower - Tuned w/ NeoPixels
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
import ustruct
# initialize GB neopixels
neo = init()
# timing
update_rate = 50
@RobertLucian
RobertLucian / gigglebot_line_follower_configurator.py
Created March 15, 2019 22:45
GiggleBot Remote PID Line Follower Tuner (requires the other part) - xjfls23
from microbit import *
from utime import sleep_ms
import radio
import ustruct
# 1st element is the Kp gain
# 2nd element is the Ki gain
# 3rd element is the Kd gain
# 4th element is the trigger_point for motors to lower down the speed (0 -> 1)
# 5th element is the min speed for motors as expressed in percentages (0 -> 1)
@RobertLucian
RobertLucian / gigglebot_line_follower_tuner.py
Last active March 24, 2019 17:59
GiggleBot PID Line Follower Tuner (requires a remote to tune it) - xjfls23
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
import radio
import ustruct
# initialize radio and GB neopixels
radio.on()
neo = init()
@RobertLucian
RobertLucian / pid_tuner.py
Last active February 28, 2019 20:11
PID tuner for the GoPiGo3 and the Line Follower
from curtsies import Input
from easygopigo3 import EasyGoPiGo3
from di_sensors.easy_line_follower import EasyLineFollower
from threading import Thread, Event
import signal
from time import sleep, time
def drawLogo():
print(" _____ _____ _ _____ ____ ")
@RobertLucian
RobertLucian / construct_call_graph.py
Created September 17, 2018 22:47
Call graph generator for python scripts (only python 2.x version)
#!/usr/bin/env python
'''
generates call graph of given python code file
in dot format input for graphviz.
limitations:
* statically tried to figure out functions calls
* does not understand classes
* algorithm is naive and may not statically find
@RobertLucian
RobertLucian / pppd-creator.sh
Created August 29, 2018 20:25
pppd basic creator for EC25-E 4G module
#!/bin/bash
echo "creating directories"
mkdir -p /etc/chatscripts
mkdir -p /etc/ppp/peers
echo "creating script file : /etc/chatscripts/quectel-chat-connect"
echo "
ABORT \"BUSY\"