Hi! I am using RMCS 2101, high toque geared dc motor with drivers. Till now I was controlling it with UART communication through serial monitor, but now I need to place that motor in the a robot where I cant connect my laptop. How do I control that motor without serial monitor (without connecting arduino with pc/laptop)? I am using arduino uno
If you have ever done some arduino tutorials, then you will realise that some of the 'blink' or led blink tutorials do not require serial monitor or a laptop. Once the arduino code is uploaded to it, the arduino blink code will keep working without laptop or computer or serial monitor. The arduino will run the uploaded code as long as the arduino has a power supply connected up...... like a suitable battery.
I had a quick look at the RMCS 2101 motor/driver page.
Your existing sketch simply appears to act as a gateway between the serial port and the motor-driver itself.
You need to rewrite the code with what you know to eliminate serial interface (or complement it) in order to achieve what you want.
Probably the best place to start would be posting your existing code (in code tags), and a diagram of how you’ve wired everything up.
You can control your robot by using a bluetooth SPP module such as the HC-05.
I believe that if you connect it to digital pins 0 and 1, then no change is needed to your code. (can someone please correct me if I am wrong about that?).
Otherwise you can use other pins and use SoftwareSerial - very easy to modify your sketch.
Make sure that you cross the signals over so that Tx on the Arduino goes to Rx on the Bluetooth module, and vice versa.
I am writing like this (please correct me if I am wrong)
In this case first time I need to open the serial monitor and type something. Once I type anything( like s0 or s100 doesnt matter), motor starts running at "s100". It keeps running even after i close serial monitor
For a beginner, I2C is probably harder to master than simple serial, and you haven’t quite got that sorted out yet.
Your code in reply #9 is simply wrong. Fix and understand that before you buy another motor with I2C ! It will work if coded properly.
It’s good that you’re trying to take small steps, but perhaps even smaller for a moment until you get some familiarity with the structure and synttax - and simple serial.
I didn’t see the wiring diagram requested in reply #3, was it lost?
This is a critical part of developing a project, needed before code, not after.
Agreed, harder to master (and understand how it works) but if you get it it's much easier to deal with as you don't have to worry about start/end tags and that kind of things. There's just much less of such ambiguity in the communication itself.
As there's an I2C interface there's a fair chance that someone has written and published a library to control that motor.
it was taking input as "S100" so what i did that i have defined two different strings of "S" and "100" and then added those string to store it in a new string
Then converted that string to array using toCharArray() and then mySerial.println(array) and bingo motor is running without serial monitor and i can even run it without laptop