I have problem to send data from processing to arduino mega.
Processing Code :
import processing.serial.*;
Serial myPort;
void setup()
{
println(Serial.list());
String arduinoPort = Serial.list()[0];
myPort = new Serial(this, arduinoPort, 9600)
}
void draw()
{
byte a= 3;
myPort.write(char(a));
}
Arduino Code :
#include <Servo.h>
#include <Wire.h>
Servo myservo1;
Servo myservo2;
void setup()
{
Serial.begin(9600);
myservo1.attach(9);
myservo2.attach(10);
myservo1.write(90);
myservo2.write(90);
}
void loop()
{
if(Serial.available()>0){
myservo1.write(70);
myservo2.write(70);
}
}
Code is really simple, processing send a value to trigger arduino mega turning 2 servo motors.
But it doesn't response at all.. Please help if anyone has any clue.
Thanks :))