bitbeambot-d2

Build Instructions

Source code (Arduino  & Python):

/*
* 3B-Delta
* Copyright Jason Huggins, 2012
* jason@jrandolph.com
*/
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
int startingPosition = 40;
int incomingCommand = 0;
int incomingPosition = 0;
int Arm1 = 9;
int Arm2 = 10;
int Arm3 = 11;
void setup()
{
Serial.begin(9600);
servo1.attach(Arm1);
servo2.attach(Arm2);
servo3.attach(Arm3);
servo1.write(startingPosition);
servo2.write(startingPosition);
servo3.write(startingPosition);
}
void loop()
{
if (Serial.available() >= 2) {
incomingCommand = Serial.read();
incomingPosition = Serial.read();
if (incomingCommand == 49){ // int value of "1"
servo1.write(incomingPosition);
}
if (incomingCommand == 50) { // int value of "2"
servo2.write(incomingPosition);
}
else if (incomingCommand == 51) { // int value of "3"
servo3.write(incomingPosition);
}
// say what you got:
/* Only useful for debugging for now…
Serial.print("Arduino received a command!: ");
Serial.println(incomingCommand);
Serial.print("Position: ");
Serial.println(incomingPosition);
*/
}
}

view raw
Deltabot-Arduino.ino
hosted with ❤ by GitHub

"""
# BitbeamBot – Delta
# Copyright 2012 Jason Huggins
# jason@jrandolph.com
Check out the robot in action:
http://youtu.be/iO1NP-NvcMc
"""
import serial
import time
# TODO (hugs): make this a command line arg or object init parameter
SERIAL_PORT_ID = "/dev/tty.usbmodem621"
class Bot:
def __init__(self):
self.serial = serial.Serial(SERIAL_PORT_ID,9600,timeout=1)
def send_command(self, command, position='0'):
self.serial.write(command)
self.serial.write( chr(position) )
def a(self, position):
return self.send_command("1", position)
def b(self, position):
return self.send_command("2", position)
def c(self, position):
return self.send_command("3", position)
def down(self):
for i in range(25,55):
self.a(i); self.b(i); self.c(i)
time.sleep(.03)
def up(self):
for i in range(55,25,1):
a(i); b(i); c(i)
time.sleep(.01)
if __name__ == '__main__':
bot = Bot()
a = bot.a; b=bot.b; c=bot.c; up=bot.up; down=bot.down

view raw
deltabot.py
hosted with ❤ by GitHub

Copyright (C) 2012 Jason R. Huggins
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

view raw
LICENSE-MIT.txt
hosted with ❤ by GitHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s