Q: Arduino control over serial interface
#1
Posted 13 July 2011 - 10:09 AM
I believe someone found some program that lets you do something over the serial connection, but I can't remember the name.
Any help please?
#2
Posted 13 July 2011 - 10:24 AM
-Ben
SSCoasters Staff | The SSCoasters Forum Rules
University of Illinois at Urbana Champaign | Computer Science & Mathematics
Fireball | Kingda Ka | Inclination | Diamondback
#3
Posted 13 July 2011 - 10:28 AM
The arduino is indeed connected with the usb to the computer. However, when in the arduino environment, it is possible to start a "serial connection". With this your arduino can write data to the pc and the pc will read it out and show it in a textbox.
However, I believe there are programs which can easilly send/receive data using this protocol and even allow you to create your own "program". For instance, a screen with buttons that allow you to send a certain "data bit" and "lights (graphics)" that change to the information received.
#4
Posted 13 July 2011 - 10:37 AM
SSCoasters Administrator
The SSCoasters Forum Rules
#5
Posted 13 July 2011 - 10:49 AM
So basically you're looking for a way to dynamically send instructions to your Arduino without having to "hard code" anything, i.e. you want to activate/deactivate individual pins on the fly from a user-interface? I'm sure something like this exists but it would be good practice to write one yourself I think (not to mention rewarding as you'd likely learn a fair bit).
In C++/what i can make of arduino language the program could be done on the command line somewhat simply, like this:
int main(int argc, char *argv[]) { int input; int state; while scanf("%d", input) { switch(input) { case 0 { state = digitalRead(0) if state = 0 digitalWrite(0, HIGH) else //state = 1 digitalWrite(0, LOW) } case 1 //repeat case 0 info changing the 0s to proper numbers case 2 //repeat case 0 info changing the 0s to proper numbers case 3 //repeat case 0 info changing the 0s to proper numbers case 4 //repeat case 0 info changing the 0s to proper numbers case 5 //repeat case 0 info changing the 0s to proper numbers case 6 //repeat case 0 info changing the 0s to proper numbers case 7 //repeat case 0 info changing the 0s to proper numbers case 8 //repeat case 0 info changing the 0s to proper numbers case 9 //repeat case 0 info changing the 0s to proper numbers case 10 //repeat case 0 info changing the 0s to proper numbers case 11 //repeat case 0 info changing the 0s to proper numbers case 12 //repeat case 0 info changing the 0s to proper numbers case 13 //repeat case 0 info changing the 0s to proper numbers case 14 //repeat case 0 info changing the 0s to proper numbers case 15 //repeat case 0 info changing the 0s to proper numbers } } }
Hope this is what you're looking for/helps. It's not going to be plug and play but here's the general idea of what you seem to be wanting.
-Ben
SSCoasters Staff | The SSCoasters Forum Rules
University of Illinois at Urbana Champaign | Computer Science & Mathematics
Fireball | Kingda Ka | Inclination | Diamondback
#6
Posted 13 July 2011 - 10:58 AM
coastercrazy, it's somewhat like you described. But I'd prefer to send variables to the arduino and let the arduino handle what to do with it.
(For instance, you have a manual/auto bit, when in manual, it reeds the variables that are being sent by the pc and uses them to do it's thing.)
#7
Posted 14 July 2011 - 05:47 PM
However, I've been working with the Processing software all day and managed to make 2 boxes that work as switches. When the first one - Brakes - is clicked, it is turned 'on' and the arduino will switched the output high. Then it can be switched off again.
Did the same thing for attaching the motor.
So if anyone is interested, I can give you more information about it. For now, pictures!
http://www.sscoaster...mmunication.bmp
I know it's mostly just bit's n pieces of code in the pictures, but they're not meant as a guide.
Could try to a video of some sort...
#8
Posted 17 July 2011 - 04:48 PM
Maybe you can teach me how to make those buttons! Kuddos!
SSCoasters Administrator
Read The Forum Rules(smart)
#9
Posted 18 July 2011 - 10:30 AM
I don't mind explaining some of the things I managed so far. But I only have this little bit of program, got to redo a part of the communication to make it more flexible and advanced.
Cheers
#10
Posted 20 July 2011 - 03:45 PM
I made a little video on the stuff it does so far, but it was made using the webcam and bad lighting. So some colors are a bit off on the monitor, and had to go pretty close-up.
Anyway: http://www.youtube.c...h?v=JgE8g6FhAVc