add a servo into a sequence
in
Integration and Hardware
•
10 months ago
Hi everyone,
Im trying to put a basic servo rotate into this sequence after the light flashes, where i have //arduino.digitalWrite(8, Arduino.225);, can anyone help?
code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int mode = 0;
boolean once = false;
void setup() {
size(470, 280);
println(Serial.list());
arduino = new Arduino(this, Arduino.list()[0], 9600);
for (int i = 0; i <= 13; i++){
arduino.pinMode(i, Arduino.OUTPUT);
} arduino.pinMode(2, Arduino.INPUT);
}
void draw() {
if (arduino.digitalRead(2) == Arduino.HIGH)
{
println("button_press");
mode = 1;
}
else {
mode = 0;
}
if (mode == 1) {
arduino.digitalWrite(7, Arduino.HIGH);
delay(1000);
arduino.digitalWrite(7, Arduino.LOW);
delay(500);
arduino.digitalWrite(7, Arduino.HIGH);
delay(100);
arduino.digitalWrite(7, Arduino.LOW);
delay(1000);
//arduino.digitalWrite(8, Arduino.225);
println(once);
once = true;
}
else {
arduino.digitalWrite(7, Arduino.LOW);
}
}
1