Go Down

Topic: [SOLVED... Almost] ideas/help for arduino gsm remote control of engine preheater (Read 8793 times) previous topic - next topic

winner10920

And the setup is the same, just declare the one wire bus pin and pass it to the dallas temin

boelle

#46
Feb 04, 2012, 04:56 pm Last Edit: Feb 04, 2012, 05:03 pm by boelle Reason: 1
i Shamelessly ripped off a bit from that and adjusted my sketch... i have attached it as it is now.

i tried to make and OR thing:

{
    if(Newtemp - Oldtemp > 5);
   {
    if(Newtemp1 - Oldtemp1 > 5)
     
     {
     Tempflag = 1;
     }

but i can see it will not work

i know && means AND.... but how do i make an OR ?

winner10920

== means equal to
&& means and
|means or

Id sugest to have a newtemp1 and newtemp2 and the same for old, and flag this way they operate independently
otherwise if one triggers
The other wont trigger

AWOL

Putting semicolons on your if statements isn't going to help
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

wildbill

Quote
== means equal to
&& means and
|means or

Typo? While that is true, logical or || is what is required here, not bitwise or |

winner10920

Yeah just noticed that typo now, was literally just gonna correct it

OpenElectronics

Excuse me for the intrusion,
you can find complete  sketch for the TiDiGino in google code http://code.google.com/p/tidigino/

more info in open-electronics.org blog http://www.open-electronics.org/tidigino-the-arduino-based-gsm-remote-control/

Store in http://store.open-electronics.org/TiDiGino

Help here: http://www.open-electronics.org/contacts/
or from the community http://www.facebook.com/OpenElectronics

XD
Boris Landoni

http://www.open-electronics.org

boelle

hi.. i will return later... i'm freezing outside trying to figure out why car has so hard time starting.. must be due to -11 degree C right now and it dropping more later at night

boelle

while i thaw a bit i will adjust the sketch....

i did get the sketch examples from google but they do not suit my needs

boelle

i tried to adjust a bit but got some errors:


sketch_feb01b.cpp: In function 'void loop()':
sketch_feb01b:136: error: expected primary-expression before '||' token
sketch_feb01b:136: error: expected primary-expression before 'if'
sketch_feb01b:136: error: expected `;' before 'if'
sketch_feb01b:226: error: expected `}' at end of input
sketch_feb01b:226: error: expected `}' at end of input

new sketch attached

boelle

i can get it to compile until i add: || if(Newtemp1 - Oldtemp1 > 5)

AWOL

Tha's not really surprising, because it is syntactically incorrect.
||if is not a recognized C construct.
Tell us what you want to do.

Post code, even.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

boelle

i did attach the sketch as post would grow to big for me to allow to post:



what i wanted was to make a if statement that in basic would look something like this:

if(Newtemp - Oldtemp > 5) OR if(Newtemp1 - Oldtemp1 > 5)

ie, if either one is true then trigger... it does not matter which one

wildbill

Your memory of basic has become rusty, however:
Code: [Select]

if(((Newtemp - Oldtemp) > 5) || ((Newtemp1 - Oldtemp1) > 5))
{
//do my stuff
}

likely too many parens, didn't want to look up the precedence

winner10920

Here's the below better written
Code: [Select]

if(newtemp - oldtemp > 5 || newtemp1 - oldtemp1 > 5){
//dosomething
}

sometimes the parenthesis is not needed : )

Go Up