Line 150... |
Line 150... |
150 |
print "Distance to run: %d " % DISTANCE |
150 |
print "Distance to run: %d " % DISTANCE |
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(1, 0) # open spi port 0, device (CS) 1 |
155 |
spi.open(0, 0) # open spi port 0, device (CS) 0 |
156 |
#spi.mode = 2 |
156 |
#spi.mode = 2 |
157 |
#spi.bits_per_word = 8 |
157 |
#spi.bits_per_word = 8 |
158 |
#spi.cshigh = False |
158 |
#spi.cshigh = False |
159 |
spi.SPI_config(spi.I2CSPI_MSB_FIRST| spi.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING| spi.I2CSPI_CLK_461kHz) |
159 |
spi.SPI_config(spi.I2CSPI_MSB_FIRST| spi.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING| spi.I2CSPI_CLK_461kHz) |
160 |
time.sleep(1) |
160 |
time.sleep(1) |