Synced movement LED and SERVO
hello,
i trying make 2 servos move , have each servo fading led strip. using varspeedservo library create sequence of positions each servo. further triggering sequences capacitive touch sensors using cap1188 breakout board.
i figured out need transistor 12v led strips make them fade. problem not sure how sync them servo movement.
thanks , appreciate help. if more precise information needed, happy tell more.
i trying make 2 servos move , have each servo fading led strip. using varspeedservo library create sequence of positions each servo. further triggering sequences capacitive touch sensors using cap1188 breakout board.
i figured out need transistor 12v led strips make them fade. problem not sure how sync them servo movement.
thanks , appreciate help. if more precise information needed, happy tell more.
code: [select]
#include <wire.h>
#include <spi.h>
#include <adafruit_cap1188.h>
#include <varspeedservo.h>
// reset pin used i2c or spi
#define cap1188_reset 52
// on mega/adk/due, sda == digital 20, scl == digital 21
// use i2c, no reset pin!
adafruit_cap1188 cap = adafruit_cap1188();
varspeedservo myservo1;
varspeedservo myservo2;
const int servopin1 = 11;
const int servopin2 = 12;
servosequencepoint sqa[] = {{60,20},{100,10},{155,30}};// go position 60 @ speed of 20...
servosequencepoint sqb[] = {{155,120},{60,120},{155,120}};
servosequencepoint sqc[] = {{155,40},{100,60},{130,120}};
void setup() {
serial.begin(9600);
serial.println("cap1188 test!");
myservo1.write(155,200);
myservo2.write(155,200);
if (!cap.begin()) {
serial.println("cap1188 not found");
while (1);
}
serial.println("cap1188 found!");
myservo1.attach(servopin1);
myservo2.attach(servopin2);
}
void loop() {
uint8_t touched = cap.touched();
if (touched == 0) {
return;
}
(uint8_t i=0; i<8; i++) {
if (touched & (1 << 0)) {
serial.print("c"); serial.print(i+1); serial.print("\t");
myservo1.sequenceplay(sqa,3);
}
(uint8_t i=0; i<8; i++) {
if (touched & (1 << 1)) {
serial.print("c"); serial.print(i+1); serial.print("\t");
myservo1.write(155);
}
for (uint8_t i=0; i<8; i++) {
if (touched & (1 << 2)) {
serial.print("c"); serial.print(i+1); serial.print("\t");
myservo1.sequenceplay(sqc,3);
}
}
serial.println();
delay(20);
}
}}
there's variables in question , sketch.
tell more led strips, needs fade (the entire strip, leds or last led lit instance) , fade relates (like desired position, actual position, time desired position, or speed ?).
i'm not sure mentioned above possible, need elaborate on want.
tell more led strips, needs fade (the entire strip, leds or last led lit instance) , fade relates (like desired position, actual position, time desired position, or speed ?).
i'm not sure mentioned above possible, need elaborate on want.
Arduino Forum > Using Arduino > LEDs and Multiplexing > Synced movement LED and SERVO
arduino
Comments
Post a Comment