Go Down

Topic: Uploading .ino files without starting arduino.exe (Read 2 times) previous topic - next topic

dxw00d

Then you need to enable verbose output in the preferences dialog.

tuxduino

You've probably already thought about this, but... You could make the sketch accept simple commands through the serial interface to set (some of) its parameters, then write a java application that would make it simple for the user to set them and transmit their values to the Arduino.
An "hallo-world" example of this could be a trackbar with range 0-255, with a "change" event callback that would send e.g. *Txxx# on the serial port; the Arduino would extract the three-digit number (xxx) and pass it to digitalWrite() to dim e.g. the builtin led.
You could then "dim a led with a mouse".

(not: * = start marker, # = end marker, T = command (Trackbar), xxx = parameter value)

My 1 cents.

Airborne

Quote
Then you need to enable verbose output in the preferences dialog.


Thanks that worked, I can see the commands that are send. I guess I have to type over the commands and build them into my java application, but isn't there an easier way, I mean there are almost 60 commands used to compile and 50 used to upload...
Is there any other way?


Quote

You've probably already thought about this, but...  You could make the sketch accept simple commands through the serial interface to set (some of) its parameters, then write a java application that would make it simple for the user to set them and transmit their values to the Arduino.


Hi tuxduino, no I didn't thought about that, but I'm interested in you theory however I do not fully understand you because I'm a complete newbie at Arduino IDE. Could you explain yourself a little more?

PaulS

Quote
I guess I have to type over the commands and build them into my java application, but isn't there an easier way, I mean there are almost 60 commands used to compile and 50 used to upload...
Is there any other way?

I don't know what you are looking at, but there is ONE command to upload. The number of commands to compile stuff depends on how many files need to be compiled.

Perhaps it would be a good idea to post the code that you compiled and the output from the build process.

tuxduino

#9
Mar 08, 2012, 08:55 pm Last Edit: Mar 08, 2012, 08:59 pm by tuxduino Reason: 1
Quote
Hi tuxduino, no I didn't thought about that, but I'm interested in you theory however I do not fully understand you because I'm a complete newbie at Arduino IDE. Could you explain yourself a little more?


The idea, at its core, is simple: suppose you have a delay of n seconds in a sketch and you want the user to be able to change it. Instead of writing

Code: [Select]

const int BLINK_DELAY_S 2   // at top of sketch

...

// later, somewhere inside the code...

delay(BLINK_DELAY_S * 1000);



and instruct the user to change "2" with e.g. "3" to have a 3 seconds delay, you write a program which has a default delay value but accepts simple (ascii-based) commands through the serial port to change that delay value at runtime.

To give you a simple, although not very robust, example, let's consider a sketch that lets you turn on and of the built-in led.
O means "turn the led On", F means turn the led oFf.

( disclaimer: only an untested snipped of code! )

Code: [Select]

void loop() {
    char ch;
    if (Serial.available() > 0) {
        ch = Serial.read();

        switch(ch) {
            case 'O':
                digitalWrite(13, HIGH);
                break;

            case 'F':
                digitalWrite(13, LOW);
                break;
        }
    }
}


Usage: open the serial monitor, type O or F and hit "send".

There are smarter and better ways to implement this, but you get the idea.
The next step is to handle commands with parameters (e.g. S10 could mean "set Speed to 10%").
Then comes the ability to store certain values in EEPROM and reload them at sketch startup.
Then... ;-P

Once you have this all working, you can write a java application that sends those commands through the serial port like the Arduino serial monitor, but instead of forcing the user to type letters and values, it provides the usual UI controls (buttons, trackbars, etc.) and handles all the protocol and conversion issues under the hood.
To control the above example, you'd just need a button with label "ON" and an "onPressed" event handler that would write('0') to the serial port and another button with label "OFF" that would wirte('F') instead.

Go Up