|
Arduino with Gen 6 board August 23, 2011 03:55PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 23, 2011 04:57PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 23, 2011 05:13PM |
Registered: 15 years ago Posts: 64 |
I found this in the cartesian_dda.pde file from line 275-291. Is this what you are referring to and also will you please guide me through this. I have just started working on the programming aspect.Quote
jamesdanielv
If you are using 5d code and not using any on/off mcodes for motor, then you will want to look for when E is at zero, and when e is greater than zero. if e is a float you will want to compare its absolute value
if (e_can_step)
{
dda_counter.e += delta_steps.e;
if (dda_counter.e > 0)
{
do_e_step();
real_move = true;
dda_counter.e -= total_steps;
if (e_direction)
current_steps.e++;
else
current_steps.e--;
}
}
// Default to the origin and not going anywhere
target_position.x = 0.0;
target_position.y = 0.0;
target_position.z = 0.0;
target_position.e = 0.0;
target_position.f = SLOW_XY_FEEDRATE;
|
Re: Arduino with Gen 6 board August 23, 2011 08:47PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 23, 2011 08:49PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 23, 2011 09:12PM |
Registered: 15 years ago Posts: 64 |
#include "SPI.h" // necessary library
int del=2; // used for various delays
word outputValue = 0; // a word is a 16-bit number
byte data = 0; // and a byte is an 8-bit number
void setup()
{
//set pin(s) to input and output
pinMode(10, OUTPUT);
SPI.begin(); // wake up the SPI bus.
SPI.setBitOrder(MSBFIRST);
}
void loop()
{
for (int a=0; a<=4095; a++)
{
outputValue = a;
digitalWrite(10, LOW);
data = highByte(outputValue);
data = 0b00001111 & data;
data = 0b00110000 | data;
SPI.transfer(data);
data = lowByte(outputValue);
SPI.transfer(data);
digitalWrite(10, HIGH);
delay(del);
}
delay(del+25);
for (int a=4095; a>=0; --a)
{
outputValue = a;
digitalWrite(10, LOW);
data = highByte(outputValue);
data = 0b00001111 & data;
data = 0b00110000 | data;
SPI.transfer(data);
data = lowByte(outputValue);
SPI.transfer(data);
digitalWrite(10, HIGH);
delay(del);
}
delay(del+25);
}
By changing the "a," I can get different voltage values.
if (e_can_step)
{
digitalWrite(Motor_pin_digital_example,HIGH); // if you want to turn on something before extruder moves.
if ( temp_state_flag<1) delay(100) ;// if this is first time after being off lets add a delay
temp_state_flag = 1; // hey we want to know not to delay again unless turned off?
// end of added stuff
dda_counter.e += delta_steps.e;
if (dda_counter.e > 0)
{
do_e_step();
real_move = true;
dda_counter.e -= total_steps;
if (e_direction)
current_steps.e++;
else
current_steps.e--;
}
}
else{// e not stepping
temp_state_flag=0;
digitalWrite(Motor_pin_digital_example,LOW);
}

|
Re: Arduino with Gen 6 board August 23, 2011 09:19PM |
Registered: 15 years ago Posts: 64 |
Quote
jv4779
Do you need an arduino connected to the gen6 ? Can't a spare pin be used from the gen6 board to control your dispenser. I am not clear when you want this dispenser pin to on and off
|
Re: Arduino with Gen 6 board August 24, 2011 12:02AM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 24, 2011 02:30AM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 24, 2011 07:53AM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 24, 2011 08:00AM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 24, 2011 11:15AM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 24, 2011 11:56AM |
Registered: 15 years ago Posts: 64 |
Quote
jamesdanielv
.....does your setup currently run?
|
Re: Arduino with Gen 6 board August 24, 2011 04:54PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 24, 2011 05:19PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 24, 2011 08:22PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 24, 2011 09:05PM |
Registered: 15 years ago Posts: 64 |
Quote
jamesdanielv
setup the arduino to be a slave and the sanguino to be master.
|
Re: Arduino with Gen 6 board August 24, 2011 09:30PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 24, 2011 11:27PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 27, 2011 06:43PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board August 28, 2011 08:58PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board August 31, 2011 04:23PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board September 01, 2011 10:23AM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board September 02, 2011 12:58PM |
Registered: 15 years ago Posts: 64 |
// use static variables.
#define miso 6 //pin on chip not using for isp!
#define mosi 5 //pin on chip not using for isp!
void setup()
{
pinMode(miso, OUTPUT); //set pin as output
pinMode(mosi, OUTPUT); //set pin as output
}
void extruderOnTasks(){
//everything here is done when extruder is first turned on
digitalWrite(miso, HIGH);
}
void extruderOffTasks(){
//everything here is done when extruder is turned off
digitalWrite(miso, LOW);
}
void loop ()
{
}

|
Re: Arduino with Gen 6 board September 02, 2011 01:32PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board September 02, 2011 02:16PM |
Registered: 15 years ago Posts: 64 |
Quote
jv4779
After connecting gen6 to your dispenser all you need to do is alter gen6 firmware to digitalWrite these pins at the correct time.
|
Re: Arduino with Gen 6 board September 02, 2011 11:19PM |
Registered: 15 years ago Posts: 1,797 |
|
Re: Arduino with Gen 6 board September 02, 2011 11:31PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board September 02, 2011 11:34PM |
Registered: 15 years ago Posts: 64 |
|
Re: Arduino with Gen 6 board September 03, 2011 06:43AM |
Registered: 16 years ago Posts: 7,616 |
Quote
I was actually thinking of adding new g-codes like G100 & G101
. RepRap has so many duplicates yet. For extruder on/off, there is M113 (and there was M103 a year ago).| Generation 7 Electronics | Teacup Firmware | RepRap DIY |