Line 151... |
Line 151... |
151 |
|
151 |
|
152 |
try: |
152 |
try: |
153 |
print "SPI configuration.." |
153 |
print "SPI configuration.." |
154 |
spi = spidev.SpiDev() # create a spi object |
154 |
spi = spidev.SpiDev() # create a spi object |
155 |
spi.open(0, 0) # open spi port 0, device (CS) 0 |
155 |
spi.open(0, 0) # open spi port 0, device (CS) 0 |
156 |
#spi.mode = 2 |
156 |
spi.mode = 1 |
- |
|
157 |
spi.lsbfirst = False |
157 |
#spi.bits_per_word = 8 |
158 |
spi.bits_per_word = 8 |
158 |
#spi.cshigh = False |
159 |
spi.cshigh = False |
159 |
spi.SPI_config(spi.I2CSPI_MSB_FIRST| spi.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING| spi.I2CSPI_CLK_461kHz) |
160 |
#spi.SPI_config(spi.I2CSPI_MSB_FIRST| spi.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING| spi.I2CSPI_CLK_461kHz) |
160 |
time.sleep(1) |
161 |
time.sleep(1) |
161 |
|
162 |
|
162 |
print "Axis inicialization" |
163 |
print "Axis inicialization" |
163 |
X = axis(spi, 0, 641) # set Number of Steps per axis Unit and set Direction of Rotation |
164 |
X = axis(spi, 0, 641) # set Number of Steps per axis Unit and set Direction of Rotation |
164 |
X.MaxSpeed(SPEED) # set maximal motor speed |
165 |
X.MaxSpeed(SPEED) # set maximal motor speed |