In the above code line "analogWrite(motp2=ir2var);" is highlighted.cant understand the error.
analogWrite(motp2=ir2var);
What was the error? Oh, never mind... too few arguments. analogWrite takes 2 arguments, you only gave it one.
Thanks aarg. I am sorry if I did not mention the error. I am giving below the code in the function in which this error appeared. I am not sure if this is the way to provide the code in brief although I have read the entire method to use the forum.
void movefwd(){
int ir1 = A0;
int ir2 = A1;
int motf1 = 33;
int motr1 = 35;
int motf2 = 37;
int motr2 = 39;
int motp1 = 41;
int motp2 = 43;
int ir1var;
int ir2var;
ir1var=255;
ir2var=255;
analogWrite(motr1=ir1var);
analogWrite(motr2=ir2var);
ir1var=0;
ir2var=0;
analogWrite(motf1=ir1var);
analogWrite(motf2=ir2var);
ir1var=ir1/4;
ir2var=ir2/4;
analogWrite(motp1=ir1var);
analogWrite(motp2=ir2var);
}
Copy of error message
Arduino: 1.6.5 (Windows 7), Board: "Arduino Due (Native USB Port)"
sketch_aug20a:66: error: too few arguments to function 'void analogWrite(uint32_t, uint32_t)'
In file included from C:\Users\Administrator.Admin-PC\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/Arduino.h:193:0,
from sketch_aug20a.ino:2:
C:\Users\Administrator.Admin-PC\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/wiring_analog.h:48:13: note: declared here
extern void analogWrite( uint32_t ulPin, uint32_t ulValue ) ;
^
too few arguments to function 'void analogWrite(uint32_t, uint32_t)'
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
What other argument can I give?
Look at reply #3.
Thanks aarg. I am sorry if I did not mention the error. I am giving below the code in the function in which this error appeared. I am not sure if this is the way to provide the code in brief although I have read the entire method to use the forum.
void movefwd(){
int ir1 = A0;
int ir2 = A1;
int motf1 = 33;
int motr1 = 35;
int motf2 = 37;
int motr2 = 39;
int motp1 = 41;
int motp2 = 43;
int ir1var;
int ir2var;
ir1var=255;
ir2var=255;
analogWrite(motr1=ir1var);
analogWrite(motr2=ir2var);
ir1var=0;
ir2var=0;
analogWrite(motf1=ir1var);
analogWrite(motf2=ir2var);
ir1var=ir1/4;
ir2var=ir2/4;
analogWrite(motp1=ir1var);
analogWrite(motp2=ir2var);
}
Copy of error message
Arduino: 1.6.5 (Windows 7), Board: "Arduino Due (Native USB Port)"
sketch_aug20a:66: error: too few arguments to function 'void analogWrite(uint32_t, uint32_t)'
In file included from C:\Users\Administrator.Admin-PC\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/Arduino.h:193:0,
from sketch_aug20a.ino:2:
C:\Users\Administrator.Admin-PC\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/wiring_analog.h:48:13: note: declared here
extern void analogWrite( uint32_t ulPin, uint32_t ulValue ) ;
^
too few arguments to function 'void analogWrite(uint32_t, uint32_t)'
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
What other argument can I give?
Thanks aarg and Delta_G. Reading the link mentioned by Delta_G cleared my doubt and verification/compile error.