Bu kısım c++ üzerinden arduinona x koordinatını gönderiyorum y koordinatı hazır ama onu gönderemedim
int xkoordinat;
int ykoordinat;
xkoordinat = eskix;
ykoordinat = eskiy;
unsigned char sonx[2] = { xkoordinat };
unsigned char sony[2] = { ykoordinat };
DWORD dNoOFBytestoWrite; // No of bytes to write into the port
DWORD dNoOfBytesWritten = 0; // No of bytes written to the port
dNoOFBytestoWrite = sizeof(sonx);
BOOL retVal = WriteFile(hComm, sonx, dNoOFBytestoWrite, &dNoOfBytesWritten, NULL);Burasıda arduino kısmı gelen veriyi okuyup servo motora gönderiyorum
void loop (){
if(Serial.available()>0) // Seri port iletişiminde veri bulunursa,
deger=Serial.read(); // Seri port okuma komutunu deger karakterine atıyoruz.
yeni = map(deger,0,255,0,180);
if(yeni>0) {
servo1.write(yeni);
servo2.write(yeni);
}
}