LOL @ GoForSmoke, while(1); is usefull for debugging when i dont want the whole procedure to run, besides PIC's don't use stupid void loop(){} anyway.
Funky_Arduino this is as much as i can get from your description, you have 61 numbers in the 2 arrays and there was a couple of other syntax errors but this code is working as close as i can get to your original description
int x[60]={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60};
int y[60]={0.00,0.05,0.10,0.16,0.21,0.26,0.31,0.36,0.41,0.45,
0.50,0.54,0.59,0.63,0.67,0.71,0.74,0.78,0.81,0.84,
0.87,0.89,0.91,0.93,0.95,0.97,0.98,0.99,0.99,1.00,
1.00,1.00,0.99,0.99,0.98,0.97,0.95,0.93,0.91,0.89,
0.87,0.84,0.81,0.78,0.74,0.71,0.67,0.63,0.59,0.54,
0.50,0.45,0.41,0.36,0.31,0.26,0.21,0.16,0.10,0.05}; // too many numbers here ,0.00};
int pwm_default[60]={ 0, 13, 27, 40, 53, 66, 79, 92,104,116,
128,139,150,161,171,181,190,199,207,215,
222,228,234,239,243,247,250,253,255,256,
256,256,255,253,250,247,243,239,234,228,
222,215,207,199,190,181,171,161,150,139,
128,116,104, 92, 79, 66, 53, 40, 27, 13}; // too many numbers here ,0};
int pwm_count_old[60]={ 5, 9,14,19,23,28,32,36,41,45,
49,53,56,60,63,67,70,72,75,78,
80,82,84,85,87,88,88,89,89,90,
89,89,88,88,87,85,84,82,80,78,
75,72,70,67,63,60,56,53,49,45,
41,36,32,28,23,19,14, 9, 5, 0};
String inString = ""; // does nothing here
int pwm_pin=6;
float output=9;
float pwm_new;
int scalling = 10;
void setup()
{
Serial.begin(9600);
}
void loop()
{
for (int index=0; index<60; index++) // Repeat for 60 points before it moves onto the next function
{
Serial.println(pwm_count_old[index]); // Debug to serial
analogWrite(pwm_pin,pwm_count_old[index]); // i would like to run through each of the pwm_count _old vector values and analog write each value
delay(2000);
}
for (int do_loop=0; do_loop<3; do_loop++)
{
for (int index=0; index<60; index++)
{
pwm_new=(output / scalling) * pwm_default[index]; //i would like to run through each of the pwm_default values multiplied by by scaling
Serial.println(pwm_new); // Debug to serial
analogWrite(pwm_pin,pwm_new);
delay(2000);
}
}
delay(10000);
}