Skip to content

Instantly share code, notes, and snippets.

/*BOB teleoperated code for use with matching python computer side stack
Copywrite 2009 Joshua Ashby
http://joshashby.com
joshuaashby at joshashby.com ([email protected])
TODO:
make the debugs have a "2" option, 0 will not debug, 1 will do serial/usb debuging, and 2 will do led debuging
add suport for changing the debug mode from serial/usb as the code is running
add some words to help with debuging and id of the debug data
add current sensing and voltage sensing for the battery and(?possibly?) have a led bargraph for each
add a temperature led/led bargraph
#!/usr/bin/env python
import serial
usbport = '/dev/ttyUSB0'
ser = serial.Serial(usbport, 9600, timeout=1)
def move(servo, angle):
ser.write(chr(255))
ser.write(chr(servo))
ser.write(chr(angle))
@JoshAshby
JoshAshby / PyTe.py
Created June 15, 2009 23:14
PyTe is a source code editor that i wrote over my summer break because i couldn't find any editors that i liked, hope he works well, does for me you will need python2.5/2.6 pyqt and possibly QT to run PyTe properly. Joshua Ashby http://joshashby.com 2009
#!/usr/bin/env python
#!/usr/local/bin/python
#====================About===========================
#PyTe
#PyTe is a source code editor that i wrote over my summer break because
#i couldn't find any editors that i liked, hope he works well, does for me
#you will need python2.5/2.6 pyqt and possibly QT to run PyTe properly
#Joshua Ashby
#http://joshashby.com
#2009
@JoshAshby
JoshAshby / gist:130972
Created June 16, 2009 23:14
just a test of sending data to an atmega
#include <stdint.h>
#include <avr/io.h>
#define USART_BAUD 115200ul
#define USART_UBBR_VALUE ((F_CPU/(USART_BAUD<<4))-1)
void USART_vInit(void)
{
UBRRH = (uint8_t)(USART_UBBR_VALUE>>8);
UBRRL = (uint8_t)USART_UBBR_VALUE;
UCSRC = (0<<USBS)|(1<<UCSZ1)|(1<<UCSZ0);
UCSRB = (1<<RXEN)|(1<<TXEN);
import Tkinter
import math
import thread
def update():
data = 1
while 1:
y = data + 1
data = y
text.set(`data`)
#!/usr/bin/perl
use DBI;
use DBD::mysql;
use CGI;
use Time::localtime;
$form=new CGI;
$f_name=CGI::escapeHTML($form->param("f_name"));
$f_email=CGI::escapeHTML($form->param("f_email"));
$f_post=CGI::escapeHTML($form->param("f_post"));
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
//-------------------------------------------
int pwm_start(void);
int pwm(int value, int pin, int speed);
int pwm_ramp(int value, int pin, int speed);
int pwm_value;
int adc_start(void);
//-------------------------------------------
int pwm_ramp(unsigned int value, int pin, unsigned int speed)
{
if (value < pwm_value) {
if (pin == 0) {
unsigned int i;
for (i=pwm_value; i>=value; i-= speed) {
OCR1AL = i;
pwm_value = i;
}
}
#include "adc.h"
#include "pwm.h"
//-------------------------------------------
//-------------------------------------------
int main(void)
{
pwm_setup();
for(;;){
pwm(65535, 0, 1);
//-------------------------------------------
/*
Main.c
2010 - Josh Ashby
[email protected]
http://joshashby.com
http://github.com/JoshAshby
freenode - JoshAshby
Simple little program for the ATINY45 that will read the ADC on PB4 and write that value to PWM on PB0