So I ran into a weird problem, that I solved, but thought I might mention to the many Arduino users.
I like to comment my code and since I am the only user, I often include “helpful” comments often containing humor. This led me to run into the " !!! " error seen on the MEGA 2560 boards but that was months ago. Now I’m using the MEGA to control some L298 H-bridges (4) to control 4 motors (channels are bridged to obtain ~ 4A current to each motor and is irrelevant).
Today, I ran into this problem which I cannot find any info on… Here is this bad code:
digitalWrite(RR_Motor_Pin1,LOW);// \ digitalWrite(RR_Motor_Pin2,HIGH);// \ // > SHOULD BE THE SAME FOR SPINNING MOVEMENTS digitalWrite(FR_Motor_Pin1,LOW);// / digitalWrite(FR_Motor_Pin2,HIGH);// /
in which RR_Motor_Pin1 = pin 12
RR_Motor_Pin2 = pin 13.
FR_Motor_Pin1 = pin 12
FR_Motor_Pin2 = pin 13.
With the comments in the code, the digitalWrite for RR_Motor_Pin2 doesn’t happen but they do for the FR_Motor_Pins. Remove the comments and everything works fine. Weird right…?
I’d love to hear some input on this if anyone knows… Moral of the story: "Stick to simple comments which don’t contain many (if any) symbols!!! <----