Go Down

Topic: User interface query! (Read 670 times) previous topic - next topic

alexrush

Hi Arduino community,

I'm thinking about creating a user interface to work with an Arduino however i'm having difficulty with how exactly I could code the software. Being a beginner, I understand coding simple programs, for example switching an LED on or off by inputing characters into the serial monitor. However, is it possible to code the serial monitor to act as a text-based, user friendly (console) application? What I mean is, could I code the serial monitor to ask the user the question: "Would you like to switch the LED on/off? Type yes or no." which the user would then enter "yes" or "no".  Another thing I want to do is to get the user to enter a position (e.g. x and y co-ordinates) and when this updated position is out outside a set range - switch the LED off, for example. I think I understand how I would code this without the arduino in a visual c++ or dev-cpp application but how would I code it with the Arduino software?! Unless there is a way to code an arduino using visual c++ but that seems complicated. Coding a normal application seems very different to coding an Arduino WITH an application...

karlok

if you know how to program it in general then you should know that you can add serial interface feature with many program langs. It is then the same as your sermonitor and arduino inerprets the commands the same
using Arduino Uno Rev 3

alexrush

Ok I don't fully understand your reply, what do you mean by serial interface features? I only want to code in C/C++ not other languages. The commands are not the same as you write things like "Serial.println" instead of "printf" if that's what you're saying. I want to code the serial monitor to ask some questions which the user will answer, rather than just put in "on" or "off" - I want a proper interface. I have yet to see anybody that has done that on the internet to show me that it can be done.

karlok

#3
Oct 26, 2012, 05:43 pm Last Edit: Oct 26, 2012, 05:53 pm by karlok Reason: 1
Look something like C++ serial communication.

Your question, however, does not concern Arduino because you know everything how to read Serial messages and evaluate them...
It is just a question of C/C++ which I do not know very much of. I found some approach like
Code: [Select]
 HANDLE hFile =
::CreateFile("COM1",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);

Maybe some C/C++ expert can explain you or better aks in a C/C++ forum (keyword: serial communication).

Here two links I found concerning your issue:
using Arduino Uno Rev 3

Far-seeker

The links karlok provided address creating a separate user interface application with C/C++.  On the other hand, if you just want to use the Arduino IDE's serial monitor for two-way serial communication here's a simple tutorial to get you started.

Go Up