OpenWrt ed elettronica                    digitale                         Licenza: http://creativecommons.org/licenses/by...
Linux un po ovunque:● modem/router● NAS● televisioni● stampanti laser                                   http://wiki.ninux....
User space                    Dal sw allhw             /dev/gpio   /dev/i2c-N       /dev/spi-N                            ...
PIOA       PA0  1          +5V  0  0  0            0V  0  0  0       PA7  0
GPIO                  Lanello di congiunzioneecho 82 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio82/directionec...
GPIO usando il C  #include <stdio.h>  #include <gpio_dev.h>  int main (void) {      fd = open (“/dev/gpio”);      ioctl (f...
Solo led?●   Optoisolatori●   Relè●   Motori●   Sensori di vario tipo●   …. composizioni varie                            ...
… CNC                                    8http://wiki.ninux.org/cnc
GPIO e stepper motor          PYTHON CLASS                                   USER SPACE             STEPPER               ...
class stepper:    """ This class allow you to drive a stepper motor using gpio pins.nThe stepper class use the follow para...
Appuntamento fisso...… alla Domenica nerd (17.30 alle 23.00).         Associazione Fusolab         Via Giorgio Pitacco 29 ...
EOF                                 ?                                Claudio Mignanti c.mignanti<at>gmail.com             ...
Upcoming SlideShare
Loading in …5
×

Openwrt, linux e GPIO al LinuxDay 2010 Roma

1,191 views
1,038 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,191
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Openwrt, linux e GPIO al LinuxDay 2010 Roma

  1. 1. OpenWrt ed elettronica digitale Licenza: http://creativecommons.org/licenses/by-sa/3.0/Autore: Claudio Mignanti c.mignanti<at>gmail.com
  2. 2. Linux un po ovunque:● modem/router● NAS● televisioni● stampanti laser http://wiki.ninux.org/Hackalicegate● ascensori● LHCSi mimetizzano intorno a noi....
  3. 3. User space Dal sw allhw /dev/gpio /dev/i2c-N /dev/spi-N I2C SPI ... GPIO KERNEL PIOA PIOB PIOC SOC
  4. 4. PIOA PA0 1 +5V 0 0 0 0V 0 0 0 PA7 0
  5. 5. GPIO Lanello di congiunzioneecho 82 > /sys/class/gpio/exportecho out > /sys/class/gpio/gpio82/directionecho 1 > /sys/class/gpio/gpio82/valueecho 0 > /sys/class/gpio/gpio82/value 5
  6. 6. GPIO usando il C #include <stdio.h> #include <gpio_dev.h> int main (void) { fd = open (“/dev/gpio”); ioctl (fd, GPIO_REQUEST, 82); ioctl (fd, GPIO_DIR_OUT); ioctl (fd, GPIO_SET, 1); sleep(1); ioctl (fd, GPIO_SET, 0); } 6trunk/target/linux/generic/files/include/linux/gpi_dev.h
  7. 7. Solo led?● Optoisolatori● Relè● Motori● Sensori di vario tipo● …. composizioni varie 7
  8. 8. … CNC 8http://wiki.ninux.org/cnc
  9. 9. GPIO e stepper motor PYTHON CLASS USER SPACE STEPPER PROGRAM /DEV/GPIO SYSFS /DEV/MOTORn STEPPER DRIVER GPIO API PWM CPU 9http://sourceforge.net/apps/trac/acme-dev/browser/kernel-stuff/stepper-driver/stepper-drv.c
  10. 10. class stepper: """ This class allow you to drive a stepper motor using gpio pins.nThe stepper class use the follow paramethers for costructor:n (enable, direction, step, [limit], [low_pwr])n """… def step (self, number=1, delay=0, recover_step=300): self.enable() time.sleep(0.001) for i in range(0, number): #check if at limit if (self.have_limit and self.limit_pin.get() == 0): self.recover_end(recover_step) self.disable() return number - i + recover_step #missing steps self.step_pin.set(0) self.step_pin.set(1) time.sleep(0.001) self.disable() 10 return 0
  11. 11. Appuntamento fisso...… alla Domenica nerd (17.30 alle 23.00). Associazione Fusolab Via Giorgio Pitacco 29 ● 11
  12. 12. EOF ? Claudio Mignanti c.mignanti<at>gmail.com 12 OpenWrt Hacker - Hardware designerpub 1024D/0DFD7CBB C94D 759A 2EF0 172F 9673 65E4 C4C1 8627 0DFD 7CBB

×