Loading...
Pages: [1]   Go Down
Author Topic: Using programming sketch to stream data to/from arduino  (Read 630 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

This is a repost from the programming forum, sorry for being a newbie, but i think it belongs here.

Ive been playing around with my Arduino Uno for a while now and have decided that I want to use it as the controller for a super simple 3 Axis CNC I have been working on.

I think I have the hardware (drivers, steppers, limit switches) pretty well locked down and figured out, what I need help with is writing the code either in programming or python to stream G-Code to the Arduino via the serial monitor.

I thought the work-flow would go something like this:

1. User loads G-Code file into Programming / Python script (even if it is simply by changing the referenced g-code file name from within the sketch editor)

2. Script issues command to "zero-out" machine by turning stepper motors until "home" switches are depressed.

3. Upon feedback from arduino that machine has been zeroed (simple if/then command?), the script would then feed the arduino the first line of translated g-code.

4. After feedback from the arduino that the first line of g-code had been completed (basically after the digital pins are done sending signals), the script would feed the arduino the next line of g-code. This process would continue until the G-Code file had been read start to finish.

What i am really looking for is the basis of a script that would allow a programming sketch to communicate back and forth with a sketch on the arduino. I want to keep the amount of programming on board the arduino to a minimum, so ideally the programing sketch would convert the g-code and issue simple step and direction commands to the arduino.

I think I can take care of all the logic of converting the g-code to step and direction commands, so what i need help with is sending those commands via the serial monitor to the arduino. any direction would be greatly apreciated!
Logged

Argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think Py-Arduino-Proxy may be usefull: https://github.com/hgdeoro/py-arduino-proxy I'm the author, don't take this as spam smiley.

It's not finished yet, but you can do many things, (digitalRead, digitalWrite, analogRead, analogWrite, write messages to 16x2 LCD) and very easy to extend. It only works in Linux, but I'm working to support windows.

I hope you find it usefull.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 313
Posts: 35493
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I think I can take care of all the logic of converting the g-code to step and direction commands, so what i need help with is sending those commands via the serial monitor to the arduino.
First off, Processing can send serial data to the Arduino with no problem. The serial data, though, does NOT go through the Serial Monitor. It goes DIRECTLY to the serial port that the Arduino is connected to.

There are examples provided with Processing that specifically deal with sending data to/receiving data from the Arduino. Have you tried any of them?
Logged

Pages: [1]   Go Up
Print
 
Jump to: