You can test this by taping a piece of 3/4" black The main loop of the example reads the calibrated sensor values and uses them to (analog voltage readings from 0 to 1023) by calling qtra.read(sensorValues) instead of If you want to skip the calibration phase, you can get the raw sensor readings Improper calibration will result in poor readings. line during the calibration phase so that each sensor can get a reading of how dark the For example, if you are making a line follower, you should slide the sensors across the During this phase, you should expose each reflectance sensor to the lightest and the LED built in to the Arduino on pin 13 while calibration is going on. The setup phase of this example calibrates the sensor for ten seconds and turns on or you can leave it disconnected and change the EMITTER_PIN #define below from 2 to The QTR-8A's emitter control pin (LEDON) can optionally be connected to digital pin 2, These reflectance sensors should be connected to analog inputs 0 to 5. This example is designed for use with six QTR-1A sensors or the first six sensors of a EMITTER_PIN – If you aren’t using one, be sure to change this to QTR_NO_EMITTER_PIN to save 400µs.NUM_SENSORS – This will be the number of sensors you have.Here’s the example I used, don’t forget you need to update the following pieces to work with your robot. With that said, you can use my library located at and has the fix in place. Also, as mentioned in the video, there is a bug in the code which may only be with Teensy boards but it causes the reading to overflow and bounce between which gives very bad output. Honestly, as shown in the video I just used the example code from the qtr-sensors-arduino library. For full disclosure, I had pin A9 (or 23) attached to sensor 8 and A2 (or 16) was attached to sensor 1 The code For the sensor readings, I fed those into teensy pins 16-23 which equates to analog pins A2-A9, either value will work. I attached the power and ground to 5V and ground and I also attached my “led on” pin or emitter pin to 5V since I don’t care to turn the emitters on and off, I just want them on all the time. I actually go through the process showing you any issues I ran into and how I resolved them. Finally, our robot that we’ve built so farĪs always, there is a video you can watch if you’re more into that sort of thing. This video covers attaching the sensor and testing the line array.Two screws with nuts to mount the QTR sensor (you could just simply use hot glue or double sided tape).Breadboard wires, in this case I used Dupont style wires with pins attached.As far as parts go, assuming you’ve already built the robot we just need the following items
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |