Loading...
  Show Posts
Pages: 1 [2] 3 4 ... 11
16  Using Arduino / Programming Questions / Re: USB Shield + EOS control on: March 08, 2013, 12:23:15 am
 smiley-slim
No one here has dealt with this project?
 smiley-sad
17  Using Arduino / Programming Questions / USB Shield + EOS control on: March 07, 2013, 10:10:03 am
Hey all.

I've recently discovered this EOS control project: http://www.circuitsathome.com/camera-control/digital-camera-control-using-arduino-usb-host-shield-part-1-basics/comment-page-2#comment-18006
It was developed by the creators of the USB shield and it seems like a great project.
Only problem, as I see it, seems to be that it's not a properly documented project and the dedicated libraries suffer from
some inconsistencies. This leads to some errors and problems that some have figured out and solved, and others have not.
Since I am not a professional coder, I've combed the aforementioned blog through and through and have managed to make some progress. But now I've encountered some errors that I cannot figure out.
If by any chance someone here has some experience with this project, I'd appreciate some help and guidance.

To sum up the steps I've taken and where I am now:
I managed to compile all sketches except EOSRemote.
It was after I:

1. Replaced qp_ccp
2. Commented out these lines in the qp_port.cpp:
// void operator delete(void *) {
// Q_ERROR(); // this operator should never be actually called
// }
3. Added the following line to eoseventhandler.h file found in EOSCamController folder:
virtual void OnObjectCreated(const EOSEvent *evt) {};

I still get the following error for EOSRemote:

EOSRemote.cpp: In member function ‘virtual void CamStateHandlers::OnDeviceInitializedState(PTP*)’:
EOSRemote.pde:-1: error: cannot declare variable ‘hnd’ to be of abstract type ‘EosEventHandlers’
/eoseventhandlers.h:12: note: because the following virtual functions are pure within ‘EosEventHandlers’:
C:\Program Files (x86)\arduino-1.0.1\libraries\ptp/eoseventparser.h:37: note: virtual void EOSEventHandlers::OnObjectCreated(const EOSEvent*) 

I suppose it has to do with the repercussions of editing the libraries, but then again, it was done by following the tips I've managed to collect over there, written by people who seem to have it all figured out.
18  Using Arduino / Installation & Troubleshooting / Re: USB HOST LIBRARY on: March 05, 2013, 01:09:48 pm
Did you ever find it?
It's over here https://github.com/felis/USB_Host_Shield_2.0 as far as I know.
19  Using Arduino / Motors, Mechanics, and Power / Re: Easy driver vs StepStick A4988 on: March 01, 2013, 06:30:58 am
Thanks for the info  smiley
20  Using Arduino / Motors, Mechanics, and Power / Re: Easy driver vs StepStick A4988 on: March 01, 2013, 02:26:14 am
The A4988 is preferred; 2000ma max vs. the A3967 at 750ma. Not much difference otherwise.
Seriously? This is quite a revelation. As far as coding, power, microstepping - no difference?
If so, am I correct in assuming that an arduino with 2 of those will be able to move 3 stepping motors
with the same control I'm used to with the ED?

Thanks
21  Using Arduino / Motors, Mechanics, and Power / Easy driver vs StepStick A4988 on: March 01, 2013, 01:27:57 am
I would very much appreciate if someone could walk me through the differences, or pros and cons of the Easy driver and the StepStick A4988.
I'm in the process of designing a project involving an arduino controlling up to 4 stepper motors, and will need microstepping.
I also have a good experience working with the ED, and am happy with it.
But I've only just now found out about the StepStick A4988 which is significantly smaller and would like to know if these two are exchangeable or if one has better offerings than the other.
Thanks.
22  Using Arduino / Programming Questions / Re: OneButton library help on: September 22, 2012, 12:04:22 am
Great news!
Have fun  smiley
23  Using Arduino / Programming Questions / Re: OneButton library help on: September 21, 2012, 08:11:30 am
Yes, this is something you can do, and you'll be able to use booleans to your benefit here.
You cannot just use "if (nameButton1 == true)" without declaring a boolean specifically for that matter.
What I mean is that you declare boolean AbuttonClicked=false, and than if you invoke Abutton's Aclick() function, change it to true as part of the actions this function does.

Code:
void aButtonClick() {
 
  if (aClickedOnce == false ) //check to see if it was pressed already. If not:
  {
    aClickedOnce = true; //flag it as pressed
    do whatever you want here
  }
  else //if it was clicked
  {
     aClickedOnce = false;  //flag it is "de"clicked.
  }
}

This way when function Bclick() wakes up it'll check to see whether AbuttonClicked is true or false (with an "if" statement, checking aClickedOnce) and will take action or not with this consideration.
Does it answer your query? Is is clearer?
24  Using Arduino / Programming Questions / Re: OneButton library help on: September 21, 2012, 05:32:52 am
Soffer made me see other possible situations, like adding other void to control this states.. Is not actually working but is a possibility i think.

KJMM that's not a possibility - that is the way OneButton works. I think maybe the problem is that you do not understand the basic structure of the lib and its basic sketches.
1. you assign OneButton object:
Code:
OneButton nameButton(A1, true);
2. You attach Click/double click or press to that button:
Code:
nameButton.attachClick(nameClick);

or
Code:
nameButton.attachPress(namePress);
3. You listen to the button in your loop:   
Code:
nameButton.tick();
4. You assign actions to each state (click/doubleclick/press):

Code:
void nameClick() //or void namePress etc...
{
What ever you want to happen
}
25  Using Arduino / Programming Questions / Re: OneButton library help on: September 20, 2012, 12:39:05 pm
KJMM - take a moment - try to tell us what it is you are trying to do because right now the main
problem is figuring this out. Your questions aren't clear at all.

Also - do a search here in the forum for OneButton lib and you'll see other sketches.
Look at those and use them to figure out what they do and how.

If the only thing you seek is how to use an "If" statement, check the learning section here at the site.

26  Using Arduino / Programming Questions / Re: OneButton library help on: September 20, 2012, 10:18:05 am
KJMM, if I understand correctly you want a "B" button to work only if "A" button was pressed prior to it?
In that case you could use a Boolean.

---Edited---

something along the lines of:
boolean AClickedOnce = false;

and than -

void BClick() {
 
  if (AClickedOnce == false )
  {
    do your action here
  }
  else
  {
    don't do anything
  }

27  Using Arduino / Networking, Protocols, and Devices / Re: Xbees not playing nice with eachother on: September 17, 2012, 09:56:31 am
Quote
Would you care to elaborate?
There is one serial port. Serial.write() and Serial.print() are two ways of sending data to the serial port. They are not ways of directing data to one device listening to the serial port versus the other device.

There should only be one device (either the PC and the Serial Monitor application or the XBee.

If you need two serial ports, you either need different hardware (like a Mega with 4 hardware serial ports) or different software (SoftwareSerial, to create a software port).
Thank you Paul. This actually means that once I run my code w/o being connected to the PC, and w/o Serial.write this should work. This - if I understand correctly - is good news. Thank you very much for clearing this out.
If on the other hand I'm missing something again - please let me know.
 
28  Using Arduino / Networking, Protocols, and Devices / Re: Xbees not playing nice with eachother on: September 17, 2012, 09:35:02 am
Quote
Am I wrong in assuming that "Serial.write" goes to Xbee and "Serial.print" goes to pc?
I'm afraid that you are.
Would you care to elaborate? Or point to a right way of doing this?
And as for for my 2nd question - " in the specific cases where it goes wrong, I do not have any of this mix up."
Please help me out here - I'm searching all around for some info and not in this forum or Rob Faludi's site do I find any.
29  Using Arduino / Networking, Protocols, and Devices / Re: Xbees not playing nice with eachother on: September 17, 2012, 09:29:51 am
Hey Paul.
By "sending debug data" you mean the Serial.print?
Am I wrong in assuming that "Serial.write" goes to Xbee and "Serial.print" goes to pc?
If this is so - in the specific cases where it goes wrong, I do not have any of this mix up.

Receiver - In this instance sends a confirmation:
Code:
case Play:
    //take care of variable speed
    stepper.setMaxSpeed(speedValue);
    stepper.moveTo(outPoint);
    stepper.run();
    //Serial.println ("Pcase");
    if(stepper.currentPosition()==outPoint)
    {
     Serial.write (1);
     
     mode=Stop;
    }
    break;
Sender - In this loop waits for confirmation and needs to act
Code:
if (Serial.available())
  {
    dataReceive = Serial.read();
    if (dataReceive == 1)
    {
      pClickedOnce = false;
      digitalWrite(playLED, LOW);
    } 
  }
30  Using Arduino / Networking, Protocols, and Devices / Re: Xbees not playing nice with eachother on: September 17, 2012, 09:11:54 am
Receiver Code:
Code:
// Movement of Optical encoder is translated to moving stepper

#include <AccelStepper.h>

//encoder/motor/driver setup
int easyDriverMicroSteps = 2;
int rotaryEncoderSteps = 75;
int motorStepsPerRev = 200;

int MinPulseWidth = 50; //too low and the motor will stall, too high and it will slow it down

int easyDriverStepPin = 4;
int easyDriverDirPin = 5;
int enablePin = 6;

volatile long encoderValue = 0;
int dataReceive = 0;
long lastencoderValue = 0;

//Values for focus points
int inPoint;
int outPoint;

//value for variable speed
int speedValue = 1000;
int mappedSpeed;

int mode;
#define Rewind 1
#define Play 2
// Stop mode is meant to enable Xbee receive changes in speed
// in values 0-255, remap to 200-100 and reyrn to Play/Rewind.
// currently not working.
#define Stop 3


AccelStepper stepper(1, easyDriverStepPin, easyDriverDirPin);

//Sleep Function - to diable ED when not active
long previousMillis = 0;
int sleepTimer = 5000;

void setup(){
  Serial.begin(115200);

  stepper.setMinPulseWidth(MinPulseWidth);
  stepper.setMaxSpeed(speedValue);             //variable to later determine speed play/rewind
  stepper.setAcceleration(100000);
  stepper.setSpeed(50000);

  pinMode(enablePin, OUTPUT);
}

void loop(){
  stepper.run();
  if (Serial.available()>0)
  {
    digitalWrite (enablePin, LOW);
    previousMillis = millis();
    dataReceive = Serial.read();
    //function to sort data reveived and action.
    dataSort ();
    //take care of variable speed
    speedValue = 1000;
    stepper.setMaxSpeed(speedValue);
    int stepsPerRotaryStep = (motorStepsPerRev * easyDriverMicroSteps) / rotaryEncoderSteps;
    stepper.moveTo(encoderValue * stepsPerRotaryStep);
  }
  else
  {
    //Stepper sleep after 5sec of no data
    unsigned long currentMillis = millis ();
    if (currentMillis - previousMillis>sleepTimer)
    {
      digitalWrite (enablePin, HIGH);
    }
  }

  switch (mode)
  {

  case Stop:
   /* if (Serial.available()>0)
      dataSort(); */
   
    break;
   
  case Rewind:
    //take care of variable speed
    stepper.setMaxSpeed(speedValue);
    stepper.moveTo(inPoint);
    stepper.run();
    //Serial.println ("Rcase");
    if(stepper.currentPosition()==inPoint)
    {
     
       
       Serial.write (1); 
     
    mode=Stop;
    }
   
    break;

  case Play:
    //take care of variable speed
    stepper.setMaxSpeed(speedValue);
    stepper.moveTo(outPoint);
    stepper.run();
    //Serial.println ("Pcase");
    if(stepper.currentPosition()==outPoint)
    {
     
       Serial.write (1);
     
     mode=Stop;
    }
    break;
  }
}

//Sort the received data and decide action
void dataSort()
{
  if (dataReceive == 3)
  {
    inPoint = stepper.currentPosition();
    Serial.print ("inpoint = ");
    Serial.println (inPoint);
  }
  else if (dataReceive == 5)
  {
    outPoint = stepper.currentPosition();
    Serial.print ("outpoint = ");
    Serial.println (outPoint);
  }
  else if (dataReceive == 1)
  {
    encoderValue ++;
    Serial.println(dataReceive);
  }
  else if (dataReceive == 2)
  {
    encoderValue --;
    Serial.println(dataReceive);
  }
  else if (dataReceive == 4)
  {
    //function to make Play or Rewind
    defineDirection();
  }
  else
    //Checking is data can be received indeed for changing speed.
    //currently after some revolutions of encoder Xbees stop communicating until reset.
    Serial.println (dataReceive);

}

void defineDirection()
{
  if (stepper.currentPosition()!=inPoint)
  {
    Serial.println ("REWIND");
    mode = Rewind;
  }
  else if (stepper.currentPosition() == inPoint)
  {
    Serial.println ("PLAY");
    mode = Play;
  }
}

void stepperMove ()
{
  stepper.run();
  int stepsPerRotaryStep = (motorStepsPerRev * easyDriverMicroSteps) / rotaryEncoderSteps;
  stepper.moveTo(encoderValue * stepsPerRotaryStep);
}
Pages: 1 [2] 3 4 ... 11