I'm pretty bad at coding (I know the basics), and I'm trying to create an array of servos in Arduino to control via Serial with Processing. I vaguely remember something about Arduino microcontrollers having really limited memory, so I'm not sure if creating an array of Servo objects would work. Here's the code I have so far:
#include <Servo.h>
Servo[] servos = new Servo[6]; //holds the servo objects
int[] servoPos = {90,112,149,45,75,8}; //holds the current position of each servo
char serialVal; //store the serialValue received from serial
void setup()
{
for(int i = 0; i < servos.length; i++) //attach servos to pins
{
servos[i].attach(i+8);
}
Serial.begin(115200); //initialize serial
}
Would an Arduino Uno board be able to support this array and utilize it like in Java? Before now, I've been creating each object separately, which was very inefficient and time-consuming to type and read.
Also, if there's anything that would stop this code from executing, please tell me. I appreciate your help.