i need to command motors to start and stop via the serial line. but i upload the code and they both just come on? wont go off or enything. they are small so for thesting i jush atached them to the pins and ground heres the code:
int message = 1;
int M1P = 5;
int M2P = 6;
int M1 = 0;
int M2 = 0;
You defined message as an integer but seem to be using it as a char or string. My guess is that’s why they just stay on. It’s an int defined as one and the character changes can’t affect it after. Try changing that.
If that doesn’t work try using softSerial library to setup a second COM port. Send commands via that port and use the default port as a serial monitor.
I don’t know why I said that earlier… A few suggestions - your scope operators { & } are not necessary Also if you are going to test message as a char you should define it as a char
char message = 1;
int M1P = 5;
int M2P = 6;
int M1 = 0;
int M2 = 0;
You should not be running motors directly off of the pins on the microcontroller! It is possible that you may have already fried something! --Test with a LED, my friend --or get a transistor for that motor!
Chris showed his complete Awesomeness by reading carefully and pointing out what should have been obvious to us all ! Ting !
Now, I would like to know another “Awesome” thingy, which may be obvious to all…(except me)
How the HECK did you Breathit, make all your code so pretty ?!?!
I thought there might be a code module now in LMR - but looking at the source it does not appear to be the case, because I would expect just a <class=code> and the implementation done with css.
I can make my code format correctly with carriage returns, spaces, and tabs with a <pre> tag… but how did you do the syntax highlighting !!!
You have probably fried the pins that were connected to the motor. If you are lucky, you only lost those pins and not the whole chip. If you can still sync, it is a good sign. Test these pins with a simple blink program and also try your original test program on a couple different pins.
I know this for 2 resons - the motors are very small (ive driven much biger motors on this board) and i wrote all the pins high and used a led and 330ohm rissistor to test thim so shut up about the f-ing motors!!!
Chris is very experienced with robot building, so he is talking from experience… He and I have damaged chips from over sinking current from them. Do you know what this means?
In a previous post you stated, “it dosint work now nothing hapens the Test LEDs dont come on or enything” and now you are saying
" i wrote all the pins high and used a led and 330ohm rissistor to test". So now they are working with the LEDs? Can you post the code you are using to test, if you have a question about that?
You need to be as clear as possible when stating your problem, if you really want help. Add pictures or diagrams if you can.
Also, since you helped me with that great formatting tip, I will let you in on a tip/trick I use. Most browsers are spell checking capable. A little squiggly line appears for misspelled words, you just right click and choose the correct spelling. It adds to the clarity of your statements.