Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Forum / Re: edit sig? on: December 01, 2010, 03:04:50 pm
2  Forum 2005-2010 (read only) / Forum / edit sig? on: December 01, 2010, 02:00:22 pm
I'm curious, how do you edit your signature in the user control panel?
I can get there and every time I type something it clears immediately.
Do you have to be a god to have a sig?
3  Forum 2005-2010 (read only) / Troubleshooting / Arduino 21?? the latest on: October 18, 2010, 05:39:54 pm
Hi, I'm new to this, working on a Mac, I had downloaded Arduino 0018 a while ago and finally bought a couple of Arduinos to work with.

I checked and saw that there is a newer version of the software Arduino 0021, so i downloaded it.

When I go to run the install package it asks me if I want to replace the version I have (18) with an older version (21). It also shows the file date of 21 as mid 2009.

Am I downloading from the wrong place? I'm going to and clicking on download.  This makes no sense to me, since I am reading in the forum that 21 is new.

Can someone please set me straight?
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Gator+ , Interrupt, pulseIn routines and millis on: December 03, 2010, 02:01:31 pm
Great! That explains the serial data screw up.
Will the standard attach interrupt routines work with the Gator?
I used an example sent to me from RuggedCircuits.
Heres a link to their pin translation.
Its towards the bottom.
I'll try the regular Arduino attach interrupt coding and move the 0-1 inputs now.
Thanks, I'll post back as soon as I try it.
5  Forum 2005-2010 (read only) / Syntax & Programs / Gator+ , Interrupt, pulseIn routines and millis on: December 03, 2010, 01:24:28 pm
I am having this incredible problem reading a simple one output encoder wheel,
the cytron simple encoder. link here:
I have it connected to PD:7 or pin 11 on the Gator+ board.
I have it connected as a switch or button which I was told would work correctly.
I have modified the blink program so that when the encoder showed a high signal (button pressed) the LED would turn on.
With this test i spun the shaft by hand and the led followed the encoder, on when high off when low.
If I used the motor (25 RPM), it blinked rapidly, blur actually, but I could tell it was working.

Now, I set up the interrupt routine (see code section below) and tested in the real program. I get nada, zip, nothing on the encoder duration counts.

The rest of the program runs beautifully, I don't understand what I am doing wrong, have been searching all over this forum for info and have tried a bunch of things.

All I can think of is throw it out to the group, and take whatever flak I get.

//************Definitions here**********************************//

//define where your pins are
int automationOpenTrigger = 0;
int automationCloseTrigger = 1;
int serviceBypassTrigger = 2;
int encoder2Count = 3;
int openRollerRelay = 4;
// 5
// 6
int zipper2Status = 7;
int zipper1Status = 8;
// 9
int tiltErrorTrigger = 10;
int encoder1Count = 11;
int closeRollerRelay = 12;
int errorLED = 13;
int stopRollerRelay = 22;
int openDoorActuator = 23;
int closeDoorActuator = 24;
int errorRelaytoAutomation = 25;

//Timing Stuff

unsigned long errorClockStart = 0;
unsigned long errorClockEnd = 0;
unsigned long counterSteps = 0;
int e1duration = 0;
int e2duration = 0;

//Define Error variables for later

int Encoder1Count = 0;
int Encoder2Count = 0;

//Interrupt setup function
  unsigned long errorFlags =0;
  errorFlags = PIND;

  // Take action based on what the various values of PIND are....

//************************Setup part of program here*************************
void setup() {

  Serial.begin(57600);  //start serial for dtat back during troubleshooting

//define pin modes below here
pinMode(0, INPUT);
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(3, INPUT); //encoder 2 interrupt pin
pinMode(openRollerRelay, OUTPUT);
pinMode(8, INPUT);
pinMode(7, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);//encoder 1 interrupt pin
pinMode(closeRollerRelay, OUTPUT);
pinMode(errorLED, OUTPUT);
pinMode(14, INPUT);
pinMode(15, INPUT);
pinMode(16, INPUT);
pinMode(17, INPUT);
pinMode(18, INPUT);
pinMode(stopRollerRelay, OUTPUT);
pinMode(openDoorActuator, OUTPUT);
pinMode(closeDoorActuator, OUTPUT);
pinMode(errorRelaytoAutomation, OUTPUT);
pinMode(26, INPUT);

// Setup Interrupt pins here
PCMSK3 = _BV(PCINT31)  // PD7 or pin11 Encoder 1
       | _BV(PCINT30);  // PD6 or pin3 Encoder 2
 PCIFR = _BV(PCIF3);     // Clear any pending pin change interrupts in group 3
 PCICR = _BV(PCIE3);     // Enable pin change interrupts in group 3 (pins 24 to 31)

  The section giving me fits is here**************************************

 //begin open roller routine here ******************************************GOOD  motor opening
   e1duration = 0;
   e2duration = 0;    
  unsigned long rollerClockStart = millis() + 5000;//5 seconds of run time
  unsigned long rollerClockCount = 0;
  while (rollerClockCount < rollerClockStart)
      digitalWrite (closeRollerRelay,LOW); //make sure the relay dont conflict
      digitalWrite (openRollerRelay,HIGH); //start the roller down  
        //***************************Need to have monitoring loops happening here******************
         tiltErrorTrigger = digitalRead (10);
         if (tiltErrorTrigger == HIGH) {  //PD4 or Pin10 Tilt sensor
        zipper1Status = digitalRead (8);
         if (zipper1Status == LOW) { // PD3 or Pin8 Zipper1
           }//end of if  
        //*************Encoder monitoring here **********************
         e1duration = pulseIn (11,HIGH,200);
       e2duration = pulseIn (3,HIGH,200);
        rollerClockCount = millis();
       }//end of While
     digitalWrite (openRollerRelay,LOW); //release the roller down relay
  } //end of if
  Serial.println("------Drop Screen Function Run-------------");
} //end of function

I also have another question, after the millis routine is run, the serial port quits printing back to my computer (Mac, Snow Leopard) I have to close the monitor and reopen it. Nothing prints to screen after the open screen function is run, not even the status messages at the end of  the function.

6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Why won't this blink? on: December 02, 2010, 11:37:10 am
Thanks Robtillaart!
That nailed it!
I knew it HAD to be something simple!
7  Forum 2005-2010 (read only) / Syntax & Programs / Why won't this blink? on: December 02, 2010, 11:11:20 am
I am trying to get a timer to work using millis, when I run this in the Main Loop, the LED turns on (Gator+ board so LED inverted), runs for 10 seconds then turns off.
So the while statement is working, but why doesn't the LED blink?

if (serviceBypassTrigger == HIGH ) //let system open and close doors while error is live
  unsigned long errorClockStart = millis() + 10000;
  unsigned long errorClockCount = 0;
  while (errorClockCount < errorClockStart)
   errorClockCount = millis();
   digitalWrite (errorLED,LOW);
   digitalWrite (errorLED,HIGH);

I just pasted the code cause it was so short.
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: Open circuit interrupt? on: December 01, 2010, 05:05:44 pm
Like this:
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: Open circuit interrupt? on: December 01, 2010, 04:57:14 pm
Input PortD:2 (pin 7) and PortD:3 (Pin smiley-cool.
Currently closed circuit switches connected to those ports with a 10k ohm resistor tied to ground to bring the port LOW when the switch opens.

Wired as per diagram on digital input inBrian Evans Arduino Programming Notebook.
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: How to print two variable on the serial monitor on: December 01, 2010, 12:37:53 am
OK that makes sense,
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: How to print two variable on the serial monitor on: December 01, 2010, 12:14:21 am
Interesting, in another language I program in we can print text and the variable in the same statement, like this

print("explanation %s more text %s", SerialData1, SerialData2);

The %s is for serial data, %d would be for digital data.

Nothing like that for the Arduino though?
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: multiple conditions on: November 29, 2010, 09:21:26 pm
That saves some work.
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: multiple conditions on: November 29, 2010, 09:15:27 pm
Now that is interesting, will it be true if all three match in ANY condition or only if HIGH?
14  Forum 2005-2010 (read only) / Syntax & Programs / multiple conditions on: November 29, 2010, 08:15:00 pm
I am curious, I have a controller that needs to look at the status of three inputs to give me a go or no go.

I was planning to nest if statements, then I was looking at the if statements using the && operator.

Can I do something like:

if(door1 == HIGH && door2 == HIGH && door3 ==HIGH)
go do this
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: interrupt and millis, have questions on: November 28, 2010, 06:56:54 pm
OK, change duration, got it.

AS to the second part of your reply, I was going to poll them sequentially, for a short time period, store the three values, compare the three values, make a decision, then repeat if I haven't gone past 20 seconds since the function was activated.

If the count doesn't match, then one of the gearboxes is broken. And I hit stop.

I figure at 20 RPM, running for 20 seconds, the motor is going to rotate less than 10 times, I thought the Arduino would be fast enough to go through four or five iterations during the 20 second  motor run time.

That is why I was also asking if there was a way to compare within a range, like (X == Y == Z within 5) to account for one encoder or another starting high or low compared to the other two.

SO basically, you are saying that counting pulses isn't going to work for what I am trying to do? Or are you trying to get me to look at something completely different in your own way?

If so, please spell it out, my wife will tell you that even after 20 years I don't take hints very well at all.

I'm not asking you (or anyone) to write the code, but I am surely missing what you are trying to tell me.

Pages: [1] 2