Go Down

Topic: Automated Dust Collection (Read 2761 times) previous topic - next topic

gladewater2016

The serial monitor is where I am seeing the amp increase when I turn the heat gun on. It is showing a amp increase on the miter saw from 0.07 to 5.40

adwsystems

#16
May 17, 2018, 05:28 pm Last Edit: May 17, 2018, 05:29 pm by adwsystems
You never see it print "turnOnDustCollection"?


adwsystems

#18
May 17, 2018, 05:33 pm Last Edit: May 17, 2018, 05:33 pm by adwsystems
Code: [Select]
for(int i=0;i<NUMBER_OF_TOOLS;i++)
{
 if( checkForAmperageChange(i))
 {
   activeTool = i;
   exit;
 }
 if( i!=0)
  {
   if(checkForAmperageChange(0))
   {
     activeTool = 0;
     exit;
   }
 }

What do you think that the exit statements do in this snippet?
Find tool and exit loop(). Cute function. I'm thinking this doesn't work very well.

Luckily I can admit that I didn't write it.

gladewater2016

I guess the million dollar question is, how do I fix it so it will turn on the dust collector and open a servo for the blast gate for the miter saw?

groundFungus

Actually the exit; does nothing but throw this warning.   

Code: [Select]
...\arduino_modified_sketch_800891\sketch_may17b.ino: In function 'void setup()':

C:\Users\DaD\AppData\Local\Temp\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement is a reference, not call, to function 'exit' [-Waddress]
       exit;
           ^
...\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement has no effect [-Wunused-value]



The exit(0) function would exit loop, disable interrupts and freeze.

adwsystems

#21
May 17, 2018, 05:42 pm Last Edit: May 17, 2018, 05:44 pm by adwsystems
Actually the exit; does nothing but throw this warning.    

Code: [Select]
...\arduino_modified_sketch_800891\sketch_may17b.ino: In function 'void setup()':

C:\Users\DaD\AppData\Local\Temp\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement is a reference, not call, to function 'exit' [-Waddress]
       exit;
           ^
...\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement has no effect [-Wunused-value]



The exit(0) function would exit loop, disable interrupts and freeze.
That code is in loop(), not in setup(). Why does the compiler think it is in setup()?


I installed the Adafruit PWM Servo library (against my better judgement) and do not get any errors:

Code: [Select]

Build options changed, rebuilding all
Sketch uses 9122 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 659 bytes (8%) of dynamic memory, leaving 7533 bytes for local variables. Maximum is 8192 bytes.

groundFungus

I did not say error.

Do you have all warnings turned on in Preferences?  I installed the Adafruit library and compiled his code and got the same warning.

adwsystems

#23
May 17, 2018, 05:50 pm Last Edit: May 17, 2018, 05:55 pm by adwsystems
Warnings. Errors. I don't care. I don't release code with warnings.

Show verbose output during compilation is checked and Compiler warnings is set to ALL.

Why would it freeze? Exit() would just bail from loop() back to main(). It does not sound like it is freezing as the OP is reporting seeing the Serial monitor providing data.

gladewater2016

I am using the same code that the original builder of the system used. His system is identical to mine. The only exception is, I will be adding more tools than he did.

gladewater2016

Any suggestions on how to fix it and make it work?

groundFungus

Arduino and exit(0)
I tried to point out a potential problem.  The program flow may not be as desired if the exit (whatever it is supposed to do) is ignored.  I'm done.

adwsystems

You make a good point, unfortunately you are not speaking with the creator of the program so it is landing on partially deaf ears.

On another note, I don't think I have ever used exit.

As for me helping fix it. I can, later. It is becoming a larger issue. Perhaps the OP can contact the author for direct assistance?

gladewater2016

I attempted to contact the original author a couple of months ago. He hasnt replied. The only way to contact him is by twitter.
This is probably he only project I will do with the arduino.
 I wouldnt mind paying someone to rewrite the code or what ever is necessary to make this work. Can you point me in the direction of someone who can do that?

groundFungus

First try replacing the exit statements with break statements.  The intent seems to be to break out of the for loop at those points.  Worth a try.

Code: [Select]
for(int i=0;i<NUMBER_OF_TOOLS;i++)
{
 if( checkForAmperageChange(i))
 {
   activeTool = i;
   break;
 }
 if( i!=0)
  {
   if(checkForAmperageChange(0))
   {
     activeTool = 0;
     break;
   }
 }

Go Up