you re right....
ok, heres the code... probably not working ![]()
/*
Matlab-Arduino Servo Controller
*/
#include <Servo.h>
int reading[2];
//DECLARATION---------------------
Servo servo1;
Servo servo2;
//SETUP----------------------------
void setup() {
Serial.begin(9600);
servo1.attach(2);
servo2.attach(3);
}
//LOOP--------------------------------
void loop() {
while (Serial.available()>0)
{
for (int i=0; i<2; i++)
{
reading [i] = Serial.read();
}
if (reading[0] == 201)
{
servo1.write(reading[1]);
}
if (reading[0] == 202)
{
servo2.write(reading[1]);
}
}
}