So I have fixed my code for reading Motion Register's byte 0:
# define REG_Motion 0x02
# define REG_Pixel_Burst 0x64
# define REG_Frame_Capture 0x12
...................
void setup()
{
//Initialization (Uploading Firmware and First two steps from Procedure of Frame Capture)
....
}
void loop()
{
adns_write_reg(REG_Frame_Capture, 0x93);
delay(1);
adns_write_reg(REG_Frame_Capture, 0xc5);
delay(2);
byte check_Motion_register = adns_read_reg(REG_Motion);
check_Motion_register |= B00000001;
//Display Motion Register in serial monitor
Serial.println(check_Motion_register);
if(check_Motion_register == 1)
{
for(int i = 1; i <= 900; i++)
{
Serial.println(adns_read_reg(REG_Pixel_Burst));
delay(1);
}
}
delay(100);
}
But I have one problem. In Serial Monitor Pixel_Burst register return's all pixels as zeros. Datasheet says this:
- Continue read from Pixel_Burst register until all 900 pixels are transferred.
and In code I'm using this:
if(check_Motion_register == 1)
{
for(int i = 1; i <= 900; i++)
{
Serial.println(adns_read_reg(REG_Pixel_Burst));
delay(1);
}
}
what am I doing wrong? How to fix this?