At long last I am finally able to connect Game Maker and Arduino seamlessly through the RS232 DLL by andbna. Today I share this with you.
I have made an example that includes how to write bytes to the Arduino and how to read bytes from it. You must be fairly fluent in the Arduino language in order to use this technique effectively.
Included in the following download is the gmk (GM8) example, the RS232 DLL and gml scripts for it, and the Arduino pde file.
The technique makes use of the RS232_WriteByte() function to write to the Arduino and Arduino's Serial.read() function to read from Game Maker.
Similarly it uses Arduino's Serial.print() function to write to Game Maker and RS232_ReadByte() to read from the Arduino.
You can also use RS232_ReadString() to read strings from the Arduino and RS232_WriteString() to write strings to the Arduino.
Using this example
- First open up the GMBlink.pde in your Arduino programing program. Read and understand it.
- Download the sketch to your Arduino.
- Then open up the Arduino_Blink.gmk in Game Maker. Read and understand it.
- Now find the port your Arduino is plugged into, this can be found in the device manager.
- Change the com variable to your COM port.
- Then run the game and you should be able to control your Arduino's LED with the spacebar.
Game Maker is so versatile and easy we can easily prototype Arduino programs very quickly.
For more information about the Arduino visit their website.
For more information abut the RS232 DLL and for the extension go here. Credit goes to andbna for this awesome DLL
If you have any questions just comment.
I have only tested this on my Arduino Duemilanove and I would like to see if it works on others too, so please test it if you have an Arduino.
Edit: *Link updated 2/22/13
Edited by Buff-Robotix, 22 February 2013 - 07:52 PM.