Difference between revisions of "French FX-7 robot"

From Technologia Incognita
Jump to: navigation, search
(Python code)
(Python code)
Line 25: Line 25:
  
 
== Python code ==
 
== Python code ==
<code>
+
<pre>
 
import RPi.GPIO as gpio
 
import RPi.GPIO as gpio
 
import time
 
import time
Line 48: Line 48:
 
     gpio.output(15, True)
 
     gpio.output(15, True)
 
     time.sleep(2)
 
     time.sleep(2)
</code>
+
</pre>
  
<code>
+
<pre>
 
pygame.init()
 
pygame.init()
 
screen = pygame.display.set_mode((640,480))
 
screen = pygame.display.set_mode((640,480))
Line 90: Line 90:
 
             gpio.output(13, False)
 
             gpio.output(13, False)
 
             gpio.output(15, False)
 
             gpio.output(15, False)
</code>
+
</pre>
  
 
== Future ==
 
== Future ==

Revision as of 13:32, 24 January 2014

Projects
FX-7.jpg
Participants Mi1es
Skills Electronics, Soldering, Programming, Creative thinking
Status Active
Niche Electronics
Purpose World domination

"Contrôle système! Contrôle système!"

Overview

System

Work done

Machine has been taken apart.. blblblalbla


H-bridge board has all the transistors of the original board on it for 4 full H-bridges that can drive all of the four bi-directional motors.

Layout is as follows , with the connectors of the motors facing you:

  • First block, gpio18, w1, gpio4, w7, Left tread
  • Second block, gpio17,w0, gpio23,w4, Right treads
  • Third block: gpio27,w2, gpio22,w3, hip
  • Fourth block: gpio24, w5, gpio25,w6, arms


Python code

import RPi.GPIO as gpio
import time
import pygame
from pygame.locals import *


gpio.setmode(gpio.BOARD)
gpio.setup(7, gpio.OUT)
gpio.setup(11, gpio.OUT)
gpio.setup(13, gpio.OUT)
gpio.setup(15, gpio.OUT)

gpio.output(7, True)
gpio.output(11, True)

 while True:
    gpio.output(13, True)
    gpio.output(15, False)
    time.sleep(2)
    gpio.output(13, False)
    gpio.output(15, True)
    time.sleep(2)
pygame.init()
screen = pygame.display.set_mode((640,480))
pygame.display.set_caption("Pygame")
pygame.mouse.set_visible(0)

done = False
enable = 0
direction = 0
while not done:
    for event in pygame.event.get():
        if(event.type==KEYDOWN):
            print event
            if(event.key==273):
                direction=1;
                enable=1;
            if(event.key==274):
                direction=-1;
                enable=1;     
        if(event.type==KEYUP):
            print event
            if(event.key==273):
                direction=0;
                enable=0;
            if(event.key==274):
                direction=0;
                enable=0;

        if(enable==1):
            if(direction==1):
                print "Forwards"
                gpio.output(13, False)
                gpio.output(15, True)
            if(direction==-1):
                print "Backwards"
                gpio.output(13, True)
                gpio.output(15, False)
        else:
            gpio.output(13, False)
            gpio.output(15, False)

Future