So I was able to hook up a 12V / 2Amp DC adapter (purchased off Amazon) to the board and use the sample sketch for SINGLE SERVO and it runs great. I also tried the sample sketch for 3 servos and that too works.
Next question: When I use either of the sample sketches how do I modify them to do the following:
(Basically think of this example as it's like a vending machine)
Get an incoming signal from a POS terminal (this will come into the board as either a PULSE or a SERIAL signal...please let me know which is easier for the Arduino board to accept...PULSE or SERIAL).
Once I have that signal coming into the program I want it to activate Servo_0 for one complete cycle. This means extend the actuator/servo from 1000 to 2000. I have that working repeatedly now with the sample program but I need it to stop after one cycle. At the moment it just keeps looping.
After we have this working I'd like the next time a signal comes in from the POS to instead activate Servo_1. This will continue each time a signal is sent from the POS using Servo_2, then Servo_3, Servo_4, etc...up to Servo_7.....then start back from Servo_0 again.
I also want to insert an optical sensor right after each actuator/servo cycles to give the system feedback that a unit has been dispensed. There would only be ONE optical sensor that would be used for all 8 servos/actuators.
Thank you in advance!
Here is the sample code so far:
//
/ Inovatic-ICT d.o.o /
/ /
/ EMoRo Example: SingleServo /
/ Board name: EMoRo 2560 v3.2 /
/ MCU name: ATMEGA2560-16 /
/ Clock: 16 MHz /
/ File description: /
/ This sketch controls the servo motor attached to defined servo port end sends coresponding /
/ description to console port. EmoroServo.attach(); initialize servo on desired port. /
/ After initialization with EmoroServo.attach(); pulse width is automatically set to /
/ 1500us. It is possible to use max. 8 servo motors on ports SERVO_0 to SERVO_7. After /
/ initialization, servo pulse is controlled by EmoroServo.write(, ); Background /
/ engine will repeat that pulse width every 20ms automatically until it is not changed by new /
/ EmoroServo.write(, ); or terminated with EmoroServo.detach(); /
/ EmoroServo.read(); will return current pulse width in us (micro seconds). /
/ The circuit: /
/ Connect servo motor with JR cable to SERVO_0 (white triangle (pin 1) is ground (black wire)) /
/ /
/ Necessary equipment: /
/ EMoRo 2560 controller /
/ Servo motor with JR cable /
/ More info: www.emoro.eu /
//
int servoPort = SERVO_0; // select the pin for the servo motor
int waitState = 2000; // time in milliseconds between actions
void setup(void){
Serial.begin(9600); // initialize serial communication:
Serial.println("Example: SingleServo"); // send example name to console
EmoroServo.attach(servoPort); // initialize servo motor on selected port
Serial.print("Pulse width: "); // print string
Serial.print(EmoroServo.read(servoPort)); // print current servo pulse width
Serial.println(" us\n"); // print string
}
void loop(void){
// Set servo pulse to 1000us. For position servo motors this will set the left position,
// for servo motors with continuous rotation this will set continuous rotation in CCW direction
EmoroServo.write(servoPort, 1000);
// print action to console
Serial.println("Set servo pulse to 1000us");
Serial.println("Standard servo: set left position");
Serial.println("Rotation servo: rotation in CCW direction\n");
// wait for specified time in milliseconds
delay(waitState);
// Set servo pulse to 1500us. For position servo motors this will set the middle position,
// for servo motors with continuous rotation this will stop rotation
// EmoroServo.write(servoPort, 1500);
// print action to console
Serial.println("Set servo pulse to 1500us");
Serial.println("Standard servo: set middle position");
Serial.println("Rotation servo: stop\n");
// wait for specified time in milliseconds
delay(waitState);
// Set servo pulse to 2000us. For position servo motors this will set the right position,
// for servo motors with continuous rotation this will set continuous rotation in CW direction
EmoroServo.write(servoPort, 2000);
// print action to console
Serial.println("Set servo pulse to 2000us");
Serial.println("Standard servo: set right position");
Serial.println("Rotation servo: rotation in CW direction\n");
// wait for specified time in milliseconds
delay(waitState);
// Set servo pulse to 1500us. For position servo motors this will set the middle position,
// for servo motors with continuous rotation this will stop rotation
// EmoroServo.write(servoPort, 1500);
// print action to console
Serial.println("Set servo pulse to 1500us");
Serial.println("Standard servo: set middle position");
Serial.println("Rotation servo: stop\n");
// wait for specified time in milliseconds
delay(waitState);
}
//
/ end of file /
//