Pages: 1 2 3 [4] 5 6 ... 8   Go Down
Author Topic: [SOLVED... Almost] ideas/help for arduino gsm remote control of engine preheater  (Read 7905 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?

* sketch_feb01b.ino (9.87 KB - downloaded 9 times.)
« Last Edit: February 04, 2012, 11:03:48 am by boelle » Logged

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

== 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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26293
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Putting semicolons on your if statements isn't going to help
Logged

"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.

New Jersey
Online Online
Faraday Member
**
Karma: 67
Posts: 3694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
== means equal to
&& means and
|means or
Typo? While that is true, logical or || is what is required here, not bitwise or |
Logged

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
http://www.open-electronics.org
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

 smiley-lol
Boris Landoni
Logged


Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* sketch_feb01b.ino (9.88 KB - downloaded 7 times.)
Logged

Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26293
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Odense, Denmark
Offline Offline
Full Member
***
Karma: 0
Posts: 214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

New Jersey
Online Online
Faraday Member
**
Karma: 67
Posts: 3694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your memory of basic has become rusty, however:
Code:
if(((Newtemp - Oldtemp) > 5) || ((Newtemp1 - Oldtemp1) > 5))
{
//do my stuff
}
likely too many parens, didn't want to look up the precedence
Logged

Offline Offline
Edison Member
*
Karma: 5
Posts: 1730
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the below better written
Code:
if(newtemp - oldtemp > 5 || newtemp1 - oldtemp1 > 5){
//dosomething
}
sometimes the parenthesis is not needed : )
Logged

Pages: 1 2 3 [4] 5 6 ... 8   Go Up
Jump to: