ADNS 2050E


hi,

i have problem accessing adns 2050e
i have sourcecode arduino 255-255. do wrong? usb-uart interfering signals?
if knows have done wrong in code please me...

i have  a adns 5020e try read deltax , deltay from. 255-255 registers. do wrong. have included modified version of benoĆ®t rousseau's example. please if soneone knows why wont working please tell me... code compiles allright. have connected +5v , gnd sck , sdio arduino.

#define clock_pin 2 //broche_horloge
#define pin_data 3 //broche_donnees

#define _bv(bit) (1 << (bit))

byte readregister (byte adress)      //lectureregistre
{
int = 7;
byte returnread = 0;

pinmode (pin_data, output);
(; i>=0; i--)
{

   digitalwrite (clock_pin, low);
   digitalwrite (pin_data, adress & (1 << i));
   digitalwrite (clock_pin, high);
}

pinmode (pin_data, input);
delaymicroseconds(150);

(i=7; i>=0; i--)
{
  digitalwrite (clock_pin, low);
  digitalwrite (clock_pin, high);
  returnread |= (digitalread (pin_data) << i);
}
delaymicroseconds(150);

return returnread;
}

void setup()
{
pinmode (clock_pin, output);
pinmode (pin_data, input);
serial.begin(19200);
}

void loop ()
{
if (readregister (0x02))
{
  serial.print ('>');
  serial.print (readregister (0x03), dec);
  serial.print ('-');
  serial.print (readregister (0x04), dec);
  serial.println ();
}
if (serial.available())
{
  serial.read();
}
}



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > ADNS 2050E


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums