Servo USB Control

Greetings all!

I'm pretty new to the Arduino world and I'm wondering if someone could help me out.

I'm trying to configure my Arduino to rotate a Servo, But, It must do it on a command only.

I'm using a .bat file to execute a few commands (Java included) that will change my display settings from Landscape to Portrait.

What I need to know is how to execute in the same file to tell the UNO R3 that it must turn the servo to 90deg. ie( myservo.write(90); )

I've manged to do a few simple tasks of getting the servo to turn here and there, but I think this is a little more complicated.

Any help with this will be Much Appreciated!!

Or, maybe you can buy a [u]USB servo controller[/u].

I wish I could buy these things easily in South Africa, but alas I was able to find an Arduino Board.

@DVDDoug, That Pololu controller is really cool. It reminds me of the expensive Sanyo-Denki Dnet ac servo controllers I used at AMAT, (without all the bells and whistles) as far as ease of use. The script function really makes developing easy. If I were building a robot that's probably what I would choose.

What I need to know is how to execute in the same file to tell the UNO R3 that it must turn the servo to 90deg. ie( myservo.write(90); )

You can use batch files on a pc and send the command to the serial port. You will most likely need to disable the serial port open/close on the arduino with a resistor or capacitor.

So far I've had some good luck with Processing 2.2.1 where I'm able to send a arduino.servoWrite(9, 90); command in the to the UNO board and it turns the servo, Yay!

But I need it to be a stand alone app so I can execute it with a bat file. When I create the app (Ctrl+E) I get the 100mb folder with everything in it (I hope) But when I try to run it, the servo does nothing

Here is my Code:

import processing.serial.*;

import cc.arduino.*;

Arduino arduino;

void setup() {
 arduino = new Arduino(this, Arduino.list()[1], 57600);
 arduino.pinMode(9, Arduino.SERVO);
}

void draw() {
   arduino.servoWrite(9, 90);
}

Very simple nothing to extraordinary. But my success rate is declining now...

Oh and when I ran this for the first time it said it couldn't find cc.arduino so I had to click on Sketch - Add File - Arduino.jar for it to work. (not sure if this makes a difference or not)

I have tried to use the turn.java file in the source directory and javac turn.java to create a class so I can run it, but it said that it couldn't find any of the imports.

Bump!

I figured a way around it, can't believe no one could come up with this answer, Lol.

This is an open source forum. The presumption is that if you ask a question and we answer it, others can read it and benefit. What that also means is if you ask a question and you figure out the solution before we can answer it, you are supposed to share your solution with the rest of the world. If you figure out a solution and do not share it, that tells the rest of the world that you are a "USER" and you are only thinking of yourself and could care less if anyone else knows how to do it. With only 5 posts to your name and no Karma, it is obvious you are new and don't have a clue about the protocols or forum customs or anything else related to this particular forum so that make this comment of mine an "FYI" comment. You can't be held accountable for something you are not aware of. Now you know and you are accountable. I'm sure someone , somewhere could benefit from your self-taught experience. Your move.

ilsmark: I figured a way around it, can't believe no one could come up with this answer, Lol.

LOL, what took you so long? :sunglasses:

raschemmel: This is an open source forum. The presumption is that if you ask a question and we answer it, others can read it and benefit. What that also means is if you ask a question and you figure out the solution before we can answer it, you are supposed to share your solution with the rest of the world. If you figure out a solution and do not share it, that tells the rest of the world that you are a "USER" and you are only thinking of yourself and could care less if anyone else knows how to do it. With only 5 posts to your name and no Karma, it is obvious you are new and don't have a clue about the protocols or forum customs or anything else related to this particular forum so that make this comment of mine an "FYI" comment. You can't be held accountable for something you are not aware of. Now you know and you are accountable. I'm sure someone , somewhere could benefit from your self-taught experience. Your move.

Actually the fact of the matter is I asked an extremely simple question that any "Senior" member on this forum could answer and all I got was

Or, maybe you can buy a USB servo controller.

and a vague solution from zoomkat that possibly needs a little more understanding of how an arduino board works, but nothing else that was remotely helpful to my problem. I understand completely on how that my solution could help someone in the future, I'm just upset that no one was bothered to help, but only when I show my dissatisfaction with how I was completely ignored that I got you (raschemmel) snapping at me for not sharing my solution.

Yes I am New and I have no experience with the Arduino board, I have a small amount of knowledge in programming and scripting. But being that this was the only board I could get I thought that I could actually go to the forums and ask for help on this. I have searched Google to no end looking for a solution.

Maybe instead of jumping up & down, snapping at me and giving a wall of text, you should have said "That's awesome! How did you do it?" I would have been excited to share my solution cause maybe you actually just didn't know how to do it.

Anyway here is my solution but I still had to create 2 bat and pde files to control what I wanted.

download processing from Processing.org

Extract the zip and run.

Create your Sketch file.

Open notepad and add the following:

c:\myapp\processing-2.2.1\processing-java --run --sketch=c:\myapp\turn\ --output=c:\myapp\run\ --force

The first line "c:\myapp\processing-2.2.1\processing-java" is to locate the exe file processing-java which should be in the processing route directory. Run to tell it that you want to run this sketch file Sketch is the file that you have create and want to run. Output is the directory that it need to be outputted to. Force will forcibly remove the same directory and every time you run the command.

Now save the file as a .bat in any directory (cause we have told it where to look for the exe file)

Now run and enjoy the feeling :)

Note: There is an issue where sometimes the COM port comes back as busy. Maybe it's because the USB goes into standby or switches off. Not 100% sure.

+Note: All this is doing is uploading and running the sketch on the device, I still haven't figured out how to contently talk to the board.

If anyone needs assistance with this I would be more the willing to help.

Moved oh and I do believe that is Check & Mate

Hi,

The first line "c:\myapp\processing-2.2.1\processing-java" is to locate the exe file processing-java which should be in the processing route directory. Run to tell it that you want to run this sketch file Sketch is the file that you have create and want to run. Output is the directory that it need to be outputted to. Force will forcibly remove the same directory and every time you run the command.

Now save the file as a .bat in any directory (cause we have told it where to look for the exe file)

Good that you fund a solution, however it is in the arduino environment not necessarily the PC environment that you will find most of the expertise here.

I'm pretty new to the Arduino world and I'm wondering if someone could help me out.

Exactly, that is the reason you came here, for arduino solution, you solution is in the PC world.

So;

I figured a way around it, can't believe no one could come up with this answer, Lol.

If there was an arduino solution we could, but don't, say.

We figured a way around it, can't believe you could not have come up with this answer, Lol.

Tom..... :)

Sorry, I'm still in the right :)

You could have said something like that right at the beginning of the post that the expertise here is mostly for the Arduino Environment I would have completely understand and tried to find a new path, but instead it had to become a thing. And that is the only reason you are posting now as it is more conflict that you are looking for in this forum, not anything else.

Just remember I'm barking because you are.

Again, you could have said something like "Sorry, we should have mentioned this at the beginning that most of our experience is in the Arduino Environment - maybe try X"

But instead you come in with arrogance on your shoulders.

@ilsmark, Thank you for your contribution. I apologize if you were offended. I gave you some karma because you took the time to contribute for the benefit of others, although I think your attitude was a bit harsh. (I don't think mine was) I think you are overreacting or being too sensitive. I clearly stated that my comment was FYI.

so that make this comment of mine an "FYI" comment. You can't be held accountable for something you are not aware of. Now you know and you are accountable. I'm sure someone , somewhere could benefit from your self-taught experience.

which is not "snapping" as you put it.

As I stated, you are not familiar with this forum. If you look at the topic categories , there is a topic for Processing related questions Interfacing with Software etc. Project Guidance is not the best place to post for a Processing issue. You obviously have determination which is a good character trait. Being oversensitive, not so much. In the future I would recommend focusing on the content of the replies and making an effort to leave your emotions out of it. There was no emotion in my reply, just information , or more accurately "For Your Information". I have no experience with java or Processing so I had no advice for you on your problem. We try to be professional here, meaning we try to exchange questions and information without a lot of hystrionics..

ilsmark: I wish I could buy these things easily in South Africa, but alas I was able to find an Arduino Board.

You clearly didn't look here.....

I'm just upset that no one was bothered to help

It is questionable how much effort you actually spent looking for a solution, like below. Bottom is batch file code I've used a long time ago to send commands to an ssc-32 servo controller.

http://bit.ly/1ENzltY

::@echo off
mode com3:9600,N,8,1 >nul

echo #0P2200 >com3
ping -n 2 127.0.0.1 >nul

echo #0P1500 t3000 >com3
ping -n 5 127.0.0.1 >nul

echo #0P2200 >com3
ping -n 2 127.0.0.1 >nul

echo #0P1500 t3000 >com3
ping -n 5 127.0.0.1 >nul

echo #0P2200 >com3
ping -n 2 127.0.0.1 >nul

exit

@raschemmel Thanks you very much and I do apologize that if I was a bit to sensitive :(

I do appreciate how these types of forums can help people with their projects!

@JimboZA - Thank you for letting me know now.

@zoomkat - I suppose it all depends how you phrase it in Google search. You got lucky. But thanks for the info!

@raschemmel Thanks you very much and I do apologize that if I was a bit to sensitive :frowning:

I do appreciate how these types of forums can help people with their projects!

If anyone does ever help you, it is customary to give them some karma. (you didn’t help me but you helped
an unknown number of members who haven’t posted yet). If you ever need hardware help. I’m usually around.

FYI, if you feel the urge to tell someone that you gave them karma the forum code for that is a “+1” at the beginning of your reply.

raschemmel: If anyone does ever help you, it is customary to give them some karma. (you didn't help me but you helped an unknown number of members who haven't posted yet). If you ever need hardware help. I'm usually around.

FYI, if you feel the urge to tell someone that you gave them karma the forum code for that is a "+1" at the beginning of your reply.

Will definitely do so thanks for the advice!

ilsmark: @JimboZA - Thank you for letting me know now.

Whereabouts are you, btw? Micro Robotics courier for a flat rate, R70 iirc, don't quote me.

If you're in or around Johannesburg, Durban or Cape Town, Mantech's good for normal electronics stuff. Their Arduino parts are waaaaay over-priced though.