Ok i have these on my chess robot but dont remember what i had to do to get them to work. It is the pololu digital line sensor http://www.pololu.com/catalog/product/959 . Im using a arduino and 4 1.2v batteries. Here is my code. Please i forgot how to use these.
int sensor= 4;
int x;
void setup(){
pinMode (sensor, INPUT);
digitalWrite(sensor, HIGH);
delay(15);
Serial.begin(9600);
}
void loop(){
x= digitalRead(sensor);
Serial.println(x);
}
telefox
December 25, 2009, 6:26pm
2
Try this out: int sensor=
Try this out:
int sensor= 4;
int x;
void setup(){
Serial.begin(9600);
}
void loop(){
pinMode (sensor, OUTPUT);
digitalWrite(sensor, HIGH);
delayMicroseconds(15);
pinMode (sensor, INPUT);
digitalWrite(sensor, LOW);
delayMicroseconds(800); //Adjust this value to tweak the threshold
x= digitalRead(sensor);
Serial.println(x);
}
#include <PololuQTRSensors.h
#include <PololuQTRSensors.h>
// create an object for your type of sensor (RC or Analog)
// in this example we have three sensors on analog inputs 0 - 2, a.k.a. digital pins 14 - 16
PololuQTRSensorsRC qtr((char []) {14, 15, 16}, 3); --------------------ERROR HERE ********
// PololuQTRSensorsA qtr((char[]) {0, 1, 2}, 3);
void setup()
{
// optional: wait for some input from the user, such as a button press
// then start calibration phase and move the sensors over both
// reflectance extremes they will encounter in your application:
int i;
for (i = 0; i < 250; i++) // make the calibration take about 5 seconds
{
qtr.calibrate();
delay(20);
}
// optional: signal that the calibration phase is now over and wait for further
// input from the user, such as a button press
}
the error is in the conversion from char to unsigned char it says