If my button works as reverse like you mention - would there be a way
to fix this without getting another button?
/Rasmus
On 8 Dec., 16:18, samth <sam_thongr...@hotmail.com> wrote:
> Hi,
> I wondered if yourbuttonworks in reverse of an ordinarybutton,
> meaning instead of push to turn on, yourbuttonis push to turn
> off ???
> (as you mention it is emergencybutton).
>
> Sam
>
> On Dec 8, 4:15 am, brikbrac <brikbrac2...@gmail.com> wrote:
>
>
>
> > Hi, I don't know of there is a power issue but, my pushbuttonis
> > acting as a interrupter on my arduino. Each time a press thebutton,
> > it closes the circuit, then my arduino powers on, if I release the
> >button, the circuit is open, and everything shuts dowm.
> > Is there a problem in my connections ?
> > thanks
>
> > On Dec 7, 5:25 pm, briac <bricb...@gmail.com> wrote:
>
> > > Hi,
> > > I would like to know if there is any specification for the push
> > >button?
> > > Every time I try to connect my pushbutton(behind the 10k ohm
> > > resistance) the arduino board doesn't power on. As soon as I remove my
> > > push, everything starts and my potentiometers works fine.
>
> > > I am not sure to understand the problem.
> > > It's an emergency pushbutton(125V 6A / 300V 3A)
Rasmus,
It is possible to still use the button.
First, to make sure that if your button is working as ordinary button
or .reverse.
You can go to this page, and try these tutorials
http://arduino.cc/en/Tutorial/Button
and
http://arduino.cc/en/Tutorial/ButtonStateChange
If the button is really working in reverse, then
you only need to modify the arduino file, tagtool02.pde,
(the one you download from http://www.tagtool.org/releases/tagtool02.pde)
- assumed that you are using Nodekit Version 0.7.3
load the file to Arduino IDE
go to line 75
button_pressed |= (digitalRead(BUTTON) == HIGH);
changes the word HIGH to LOW
button_pressed |= (digitalRead(BUTTON) == LOW);
then verify and compile and upload it to your arduino,
this should work, unless there is really a problem with the button
itself.
We modified the code to let Arduino to look for the OFF/LOW state,
instead of ON/HIGH.
(reverse the procedure, if your button is doing the opposite than the
ordinary button)
So when you press the button, Arduino would confirms that you pressed
the button (on line 102)
Serial.print((button_pressed ? 255:0), BYTE);
and it will send the message to the Nodekit (since the Nodekit
expecting the value of 255 as the button press command).
Hope this help,
sam
Can't wait to test this later, thanks in advance. I will get back to
you with the results.
/Rasmus
On Jan 1, 5:02 pm, samth <sam_thongr...@hotmail.com> wrote:
> Happy New Year 2010
> to all Tagtooler out there.
>
> Rasmus,
> It is possible to still use the button.
> First, to make sure that if your button is working as ordinary button
> or .reverse.
> You can go to this page, and try these tutorialshttp://arduino.cc/en/Tutorial/Button
> andhttp://arduino.cc/en/Tutorial/ButtonStateChange
>
> If the button is really working in reverse, then
> you only need to modify the arduino file, tagtool02.pde,
> (the one you download fromhttp://www.tagtool.org/releases/tagtool02.pde)
I'm using v2 of the Nodekit, but the Arduino code you posted, but it
hasn't got the paramters you're talking about. If you check it out,
http://www.tagtool.org/releases/tagtool02.pde, maybe you can come up
with another trick?
It's not using the digitalRead(BUTTON) == high/low anymore i guess.
Thanks anyway :)
/Rasmus
On 1 Jan., 17:02, samth <sam_thongr...@hotmail.com> wrote:
> Happy New Year 2010
> to all Tagtooler out there.
>
> Rasmus,
> It is possible to still use the button.
> First, to make sure that if your button is working as ordinary button
> or .reverse.
> You can go to this page, and try these tutorialshttp://arduino.cc/en/Tutorial/Button
> andhttp://arduino.cc/en/Tutorial/ButtonStateChange
>
> If the button is really working in reverse, then
> you only need to modify the arduino file, tagtool02.pde,
> (the one you download fromhttp://www.tagtool.org/releases/tagtool02.pde)
On 1 Jan., 17:02, samth <sam_thongr...@hotmail.com> wrote:
> Happy New Year 2010
> to all Tagtooler out there.
>
> Rasmus,
> It is possible to still use the button.
> First, to make sure that if your button is working as ordinary button
> or .reverse.
> You can go to this page, and try these tutorialshttp://arduino.cc/en/Tutorial/Button
> andhttp://arduino.cc/en/Tutorial/ButtonStateChange
>
> If the button is really working in reverse, then
> you only need to modify the arduino file, tagtool02.pde,
> (the one you download fromhttp://www.tagtool.org/releases/tagtool02.pde)
If you go to the directory that your NodeKit 0.7.3 is located. And
look in the Arduino/ directory.
You will see the recent tagtool02.pde is there!
Anyway, I just want to make think a little bit easier for you.
So, here you are, the tagtool02.pde
You only need to copy and paste to the Arduino IDE. Then compile and
used it.
I already did modified the code for you. I made the comment in the
code, as well.
Good luck and enjoy!
Sam
//----------- Code start here! ---------------------------------
// (c) 2009 Thomas Pintaric (tho...@pintaric.org)
template <typename T>
class double_exponential_filter
{
public:
double_exponential_filter(const T _alpha = 1.0) :
alpha(_alpha),
has_observations(false)
{}
void reset() { has_observations = false; }
void observe(const T &x)
{
if(!has_observations)
{
S = x;
S_prime = x;
has_observations = true;
}
else
{
S = (x * alpha) + (S * (1.0-alpha));
S_prime = (S * alpha) + (S_prime * (1.0-alpha));
}
}
bool can_predict() const
{
return(has_observations);
}
T predict_t0(const T _min = 0, const T _max = 1023) const
{
if(!has_observations) return(0);
T x0 = (2.0/(1.0-alpha)) * S - (1.0/(1.0-alpha)) * S_prime;
if(x0 < _min) x0 = _min;
if(x0 > _max) x0 = _max;
return(x0);
}
protected:
T S, S_prime, alpha;
bool has_observations;
};
#define DES_ALPHA 0.05f
double_exponential_filter<float> des_slider1(DES_ALPHA);
double_exponential_filter<float> des_slider2(DES_ALPHA);
double_exponential_filter<float> des_slider3(DES_ALPHA);
double_exponential_filter<float> des_slider4(DES_ALPHA);
double_exponential_filter<float> des_slider5(DES_ALPHA);
double_exponential_filter<float> des_slider6(DES_ALPHA);
bool button_pressed = false;
#define SLIDER1 0
#define SLIDER2 1
#define SLIDER3 2
#define SLIDER4 3
#define SLIDER5 4
#define SLIDER6 5
#define BUTTON 7
void sample_inputs()
{
des_slider1.observe((float) analogRead(SLIDER1));
des_slider2.observe((float) analogRead(SLIDER2));
des_slider3.observe((float) analogRead(SLIDER3));
des_slider4.observe((float) analogRead(SLIDER4));
des_slider5.observe((float) analogRead(SLIDER5));
des_slider6.observe((float) analogRead(SLIDER6));
//********************************************************
// Here is where I modified the code for your button
// the next line is the original
//button_pressed |= (digitalRead(BUTTON) == HIGH);
// this is the modified line
button_pressed |= (digitalRead(BUTTON) == LOW);
//**********************************************************
}
void setup()
{
Serial.begin(9600);
sample_inputs();
}
void loop()
{
if(Serial.available() > 0)
{
byte request = Serial.read();
if(request == 'A')
{
//delay(10);
// Slider 1..6
Serial.print(((int)des_slider1.predict_t0())/4, BYTE);
Serial.print(((int)des_slider2.predict_t0())/4, BYTE);
Serial.print(((int)des_slider3.predict_t0())/4, BYTE);
Serial.print(((int)des_slider4.predict_t0())/4, BYTE);
Serial.print(((int)des_slider5.predict_t0())/4, BYTE);
Serial.print(((int)des_slider6.predict_t0())/4, BYTE);
// Button
Serial.print((button_pressed ? 255:0), BYTE);
button_pressed = false;
}
else if(request == 'N')
{
Serial.print("Tagtool.Controller");
}
}
else
{
sample_inputs();
}
}
My new best friend.
It works like a charm, thanks a ton.
All the best,
Rasmus
Sam