unsigned char saved_spcr = SPCR; // Save the state of the SPI module
SPCR &= ~(1<<SPE); // Disable SPI module so PB4 can be used as input
qtr_read(values, QTR_EMITTERS_ON); // change this to whatever type of QTR reading you want to do
set_digital_output(IO_B4, LOW); // Make PB4 an output so it doesn't interfere with SPI.
SPCR = saved_spcr; // Restore the state of the SPI module.
DavidEGrayson wrote:I didn't manage to officially release the new AVR library and update the documentation today, but I have made the new version available for you to download at this link:
http://www.pololu.com/file/0J380/libpol ... 100604.zip
That should let you put QTR sensors on port A using the IO_A0...IO_A7 macros, so there is no need to try to get them working on PB4. Enjoy!
-David
jlake wrote:If so that I can used the QTR-RC in the analog pin - then I might have some problems - since I will be using at least 4 analog pins for my other sensors.
jlake wrote:unsigned char qtr_rc_pins[] = {11, 14, 15, 0, 1}; // I tried to get rid of PB4 as I need the serial port at UART1
jlake wrote:I tested the serial - works perfectly.
jlake wrote:one motor is not running the way it used to be
Users browsing this forum: No registered users and 2 guests
|
My Account
|
Wish Lists
|
BIG Order Form
|
Shopping Cart
US toll free: 1-877-7-POLOLU ~
1-702-262-6648 |
|||||||||||||
| Catalog | Forum | Resources | Distributors | Ordering | About | Contact | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|