Pages: [1]   Go Down
Author Topic: need help with GUI user input to serial string to arduino  (Read 492 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need to make a small GUI that allows me to format 3 values then create a string and send that string to the serial port of an arduino mega2560.

I already tried and failed using autohotkey and a custom serial script package that was to buggy to work  smiley-sad

so my code needs to be something like this.

pseudocode  

prompt1 "enter # of pulses"
save input to var1
prompt2 "enter "pulse width in ms"
save input to var2
prompt3 "enter delay in ms"
save input to var3

string = "%var1%,%var2%,%var3%"

send %string% to arduino at (9600)
so it would send say 1000.14.14 to the serial port of the arduino

on the arduino side I'm using the function Serial.parseint();
 
so the arduino would parse the string into 3 variables
x= 1000
y = 14
z = 14
 
the arduino end is working already with the serial monitor or putty

i just need to make a clean small gui that can send serial!  

any advice on how to accomplish this quickly?

thanks
doulos

  
« Last Edit: January 31, 2013, 01:35:12 pm by doulos24 » Logged

Queens, New York
Online Online
Faraday Member
**
Karma: 98
Posts: 3598
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple, but do you know how to read in a single character? If you do then just put the incoming characters in an array, not a string, (you can but strings are highly NOT recommended). After each prompt, get the data, store it in an array then change the array. You can use a 2D array as such, "My_Array[10][3]"

My_Array[data_count][switch_count] = var;

Everytime you enter a new char, you update the data_count and store the new character. Then once you get everything from the first prompt, update switch_count, and repeat. Second prompt, repeat.

Or same idea but with seperate arrays, Array1[], Array2[], Array3[].
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a Windows forms application, written in C# that you could add text fields and labels to. Remove the existing text entry field, and change the send button to get data from all three fields to send. If you are interested, PM me with an e-mail address and I'll send it to you.
Logged

Pages: [1]   Go Up
Jump to: