Ok, thanks for helping me with my last question, but now I have another one...
I am currently trying to make a robot with a tactile switch at the front. When that tactile switch is pushed down the robot reverses and turns around. Here is the cool part though, when the switch is pushed down it will also send data to processing, causing a face to jitter onscreen. So far I have been able to make the code for the face jitter (except on mouse over) Here is the code if anybody is curious:
void setup(){
size(400, 400);
}
void draw() {
background (255);
if (mouseX >100 && mouseX < 300 && mouseY >= 100 && mouseY <= 300)
translate(random(-5, 5),random(-5,5));
fill(0);
rect(100,100,200,200);
fill(255);
rect (140, 120, 45, 45);
rect (220, 120, 45, 45);
fill(255,0,0);
rect (140, 250, 120, 30);
}
Anyways, now I am trying to get the face to jitter when a button is pushed down on the arduino.
Here is the processing code for it:
//A face that jitters when a switch on a robot is on.
Serial myPort;
void setup(){
printIn(Serial.list());
myPort = new Serial(this, Serial.list()[3], 9600);
size(400, 400);
}
void draw() {
background (255);
fill(0);
rect(100,100,200,200);
fill(255);
rect (140, 120, 45, 45);
rect (220, 120, 45, 45);
fill(255);
rect (140, 250, 120, 30);
while (myPort.available() > 0) {
int inByte = myPort.read();
if inByte = 'A'{
translate(random(-5, 5),random(-5,5));
}
}
}
With this code I keep getting the error expecting LPAREN found inByte. And now the arduino code to match that:
const int buttonPin = 12;
int buttonState = 0;
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
serialWrite(66);
}
}
With this code I get multiple errors including "couldn't determine program size" and "undefined refrence to serialWrite"
Sorry for the super long post/ confusing writing.