I'm doing a project where I need to create some kind of GUI for the user as well as control some servo motors.
I'm thinking of using ActionScript for the GUI and C for to control the hardware. Is this even possible? How do I make ActionScipt talk to C and vice-versa?
Obviously the C part will be driving the motors and will send the data to the ActionScript GUI
to be displayed to the user.
Is the above possible? If yes, could someone kindly provide me some pointers?
Thank you very much!
Edit: How do I pass a variable (e.g. x = 5) from ActionScript to be printed in C? Or is this not possible?
"You could go via ASP to a DLL as TG suggested or you could probably call an ANSI C (command line) app and pass in variables (at least on a Windows PC)... that owuld be done using FSCommands. see this tutorial
http://www.actionscripts.org/tutoria...es/index.shtml"
Originally replied by
Jesse Stratford
ActionScript.org Cofounder
This is taken from here
I don`t know the specifics of programming servo motors but basically, if you want some C to AS3 interaction you could do one of the following:
Compile your C/C++ code using flascc.
Wrap your C code in a native extension (if you are targeting AIR).
As sberry suggested - use Sockets.
Related
I want a program that C program with a C++ form application using together in the same project.
for example:
When I clicked a button send entered text to C program. entered text to inside textBox in a C++ form app.
C program will save the text to computer with file operations.
so simply example:
textBox1="hello world"
button=clicked
string^ message = textBox->Text;
writerFunction(message);
void writerFunction(char m[50])
{
FILE *fp;
fp = fopen("text.txt","a");
fprintf(fp,"%s",m);
fclose(fp);
}
It looks like you are using C++ .NET (managed c++)
I'm guessing this from pointer operator. In standard c++
you would use '*' instead of '^'.
Please correct my if I'm wrong there.
Two options.
you are using managed c++ so you can call Win32 API but you will make your work harder. If you still intrested please check this link. It will get you started.
http://www.codeproject.com/Articles/9714/Win-API-C-to-NET
But I'd suggest you to use c++ .NET approach to save the string in file. Google will find many examples for you.
One to start:
http://msdn.microsoft.com/en-us/library/19czdak8.aspx
if you want to use old style c++ you can mix c and c++ without any problems. You will need to import libs to your project.
Libraries:
C
- stdio.h examples here (http://en.m.wikipedia.org/wiki/C_file_input/output)
C++
-ofstream: Stream class to write on files
-ifstream: Stream class to read from files
-fstream: Stream class to both read and write from/to files.
More details here: http://www.cplusplus.com/doc/tutorial/files/
Windows API
- you can use win32 API by importing header
Windows.h
Few examples here (http://www.daniweb.com/software-development/c/threads/31282/windows-api-functions-to-read-and-write-files-in-c)
Good luck. If you need more info please let me know.
The simplest way is just embed your C code in C++. It should work, unless any platform specific thing barrier you.
If you do need to have two (or more) programs and if they should run as two different processes in the OS, you should use a proper inter process communication technique. I know nothing about .Net stuff. However, you may use pipes, shared memory, memory mapped files and even sockets work too.
Or else, you can create a dynamic library based on C and call the function in your C++ form application.
Can some kind soul please show me a cookbook way that I can call Esper from my C program? Ideally (I think that) I'd like to call an Esper function/method with a line of EDL and get a value returned.
EDIT: i ask this question because I have 12,000 lines of working C code that I want to keep. Esper offers some really nice event evaluation that's crucial to my C code. JNI seems to be oriented toward calling C code from Java, maybe because C is faster for some things; I want to go the other way: to call Java code from C to take advantage of the power in the Java package, which is called Esper.
Thanks!
Try the Socket Adapter in EsperIO: doc link. Seems to be aimed more at getting events into Esper though; is that what you want? Otherwise, take the concept: sockets are one proven 'cookbook' way of implementing IPC and they save all that complicated messing with JNI.
I was wondering if you take an input from the camera using c program.
I use Turbo C, windows xp. I just know the basics of c program, it would be helpful you could describe how one could do this. Thanks in advance. If any clarifications please let me know. Thanks again.
You can use Window's AVICAP:
link to the DLL AVICAP32.DLL
call capCreateCaptureWindow
send messages to it using SendMessage()
Take a look here:
http://www.codeguru.com/cpp/g-m/multimedia/video/article.php/c1601
I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver.
Can you please tell me what might be the problem?
Turbo-C, much like my first girlfriend, will always have a special place in my heart.
But its time to let her go. She's not the same girl you remember, and just cannot keep up with modern times. She may have been hip and cool at the time, but she can't handle modern trends at all. Even 32-bit memory is a real challenge for her. You're a better man now, and deserve a real woman. Go find yourself a good Visual Studio, or a nice GCC environment.
I'm not saying you have to forget Turbo-C. I know she was your first and will always be magical, but put her pictures in a shoebox, and don't take them out more than once a year. Its time to move on, buddy.
It sounds like it can't detect what kind of graphics card you have. Try setting the graphdriver parameter to either VGA or IBM8514.
In Turbo c goto options->Linker->Liabraries-> add Graphics Library.
It might help
I'm assuming that all the other prerequisites like linkers are satisfied.
Now, as we know the BGI folder is usually in the following path(i.e. if you've followed the default installation):
C:\TurboC++\disk\TurboC3\BGI
As you can see the BGI folder is inside "TurboC3" and not TC.
So the code you need to put in your program is as follows,
initgraph(&gd, &gm, "C:\\TurboC3\\BGI");
I hope this helps :) Happy graphics programming :D
you need to initialize the graphics function first.
below is the code to initialize.
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
this will initialize the graphics.
The Steps to make your TC able to run graphics program are as follows:
copy CGA.BGI and EGAVGA.BGI files from TC\BGI folder and paste them in TC\BIN directory.
Open TC by clicking on TC\BIN\TC.EXE.
Click on Options -> Linker -> Libraries .
Select the Graphics Library option and Press OK.
Now you can compile your graphics program with Zero Compilation Errors.
Thanks!
Back in the early 1990's, I used a library of routines in C called TCXL. I just wonder what ever happened to the guys who made that. I was about 25 years old the time, and learned C from a manual I printed out on my dot matrix printer. I think was using Turbo C, and I guess I downloaded TCXL from some bulletin board, or maybe Compuserve?
That library had cool routines to create "windows" for pop-ups and to create regions on the screen, as well has many other cool things that I can't fully recall. All this was in DOS of course.
http://cd.textfiles.com/swheaven1/UTILITY/
Mike Smedley, CXL's original author:
http://www.mikesmedley.com/