Arduino C kode

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From Danish to

Threaded View


Storm - Regn - Foranderligt - (Smukt - Sol)?


timer, hvordan vejret bliver.


udregnes over en 3 timers periode, hver time.



Nogen der har ideer?


Karl Erik.

Re: Arduino C kode
Karl Erik Christensen skriver:
Quoted text here. Click to load it

Quoted text here. Click to load it





Klaus
--  
 Modelbane Europas hjemmeside: http://www.modelbaneeuropa.dk
        Min egen hjemmeside: http://www.moppe.dk
We've slightly trimmed the long signature. Click to see the full one.
Re: Arduino C kode
Den 17-10-2014 kl. 23:03 skrev Karl Erik Christensen:

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

En tanke:
* Et array (liste) med tre (eller fire om man vil) pladser, en for hver  






--  
Steen Suder

Re: Arduino C kode
On Fri, 17 Oct 2014 23:03:59 +0200


Quoted text here. Click to load it

r 3  
Quoted text here. Click to load it

r  
Quoted text here. Click to load it

an.

int calculate_trend(int pressure) {
  static int trend[3]
  int i, forecast = 0;


     en dag vil udvide intervallet, bliver det nemmere. */  
  for (i = 1 ; i > 0 ; i--) {
    trend[i+1] = trend[i];
  }
  
  trend[0] = pressure;


nes.

etning


  for (i=1; i > 0; i--) {
    if (trend[i] > trend[i+1]) {
      forecast = forecast + 1;
    } else if (trend[i] < trend[i+1]) {
      forecast = forecast - 1;
    }
  }
  return forecast;
}



Som den er




 Og hvis du har brug for noget mere konkret, tror jeg godt


--  
//Wegge


Re: Arduino C kode
Den 18-10-2014 00:36, Anders Wegge Keller skrev:
Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it



Quoted text here. Click to load it




Quoted text here. Click to load it

Quoted text here. Click to load it


kompetent ud.


int savePres[9] = {0, 3, 6, 9, 12, 15, 18, 21}; // Lufttryk hver 3'die time.

if (hour() == hour()[savePres - 1]) {
  
pressure_der_skal_gemmes_og_sammenlignes_med_det_der_er_gemt_for_3_timer_siden  
= pressure;

-- her kom jeg til --




Tak for inspiration :-)

Karl Erik.


Re: Arduino C kode
Den 18-10-2014 00:36, Anders Wegge Keller skrev:
Quoted text here. Click to load it

Min "pressure" er af tekniske grunde dimensioneret som float.





if (minute() == 0 && Psat == false) {
     calculate_trend(pressure);
     Psat = true;
   }
if (minute() > 0 && Psat == true) Psat = false;

Kan det laves smartere?



Kan jeg bruge noget med:
if (hour() in hour[savePres]);

int savePres[9] = {0, 3, 6, 9, 12, 15, 18, 21};?





Det var vist lidt af en mundfuld :-)

Karl Erik.


Re: Arduino C kode
On Sat, 18 Oct 2014 07:49:05 +0200

Quoted text here. Click to load it





positivt og negativt, bliver det lidt specielt. Umiddelbart vil jeg dog tro

negativt lufttryk. '


els fordi
vi er spredt hen over 3 forskellige arkitekturer; dels fordi det tager en

gnes

ve

 int til
float.  



Quoted text here. Click to load it

 Der er en marginal forbedringsmulighed i den sidste linie:

  if (Psat && minute() > 0) { Psat = false; }



mens Psat er sand.  



Quoted text here. Click to load it

Quoted text here. Click to load it

 Nej, in findes ikke som keyword i C. Du kan bruge en modulo operator i
stedet:

 if (hour() %3 == 0) {
    /* Hver tredie time */
 }


gere  



blot
Quoted text here. Click to load it


 det
noget simplere:

int calculate_trend(float pressure) {
  static float  last = -1;
  float trend;
  int forecast = 0;

  if (last < 0) {
    last = pressure;

  }

  trend = pressure - last;

  if (trend < -3.0) {
    forecast = -2;
  } else (if trend < 0.0) {
    forecast = -1;
  } else (if trend < 3.0) {
    forecast = 1;
  } else (if trend > 3.0) {
    forecast = 2;
  }

  last = pressure;
  return forecast;
}




passende sted.

--  
//Wegge


Re: Arduino C kode
Den 18-10-2014 09:28, Anders Wegge Keller skrev:
Quoted text here. Click to load it


Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it



Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it


Quoted text here. Click to load it

Quoted text here. Click to load it



Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it


Quoted text here. Click to load it

Hej Anders - tak for "Skide godt, Egon" :-)


Normaltrykket over DK er beregnet til 1013.25hPa.

Er det under 1011.25 vises :-( og over 1015.25 vises :-)



nem at arbejde med.






Karl Erik.


Re: Arduino C kode
Den 18-10-2014 14:59, Karl Erik Christensen skrev:



Damit - damit - damit :-)

Luftrykket falder nu med rasende fart (godt 1hPs pr. time), og  




Karl Erik.



Re: Arduino C kode
Den 18-10-2014 09:28, Anders Wegge Keller skrev:
Quoted text here. Click to load it



Her er den endelige kode, som jeg forventer mig meget af :-)

static float  last = -1;
int forecast = 0.0, h;
boolean Psat = false;

void loop();
h = hour();
if (hour() == 0) {
   h = 24;
   /* Klokken bliver aldrig 24:00:00 - den skifter fra 23:59:59 til  

}
if (h %3 == 0 && Psat == false) {
   /* Hver tredie time, men kun hvis Psat er false */
   calculate_trend(Pc);
   Psat = true;
}
if (minute() > 0 && Psat == true) {
   Psat = false;

}

int calculate_trend(float pressure) {
   float trend;

   if (last < 0) {
     last = pressure;

   }

   trend = pressure - last;

   if (trend <= -3.0) {
     forecast = -2;
   } else if (trend < 0.0 && trend > -3) {
     forecast = -1;
   } else if (trend < 3.0 && trend > 0.0) {
     forecast = 1;
   } else if (trend >= 3.0) {
     forecast = 2;
   }

   last = pressure;
   return forecast;
}



Karl Erik.


Re: Arduino C kode
Den 18-10-2014 22:06, Karl Erik Christensen skrev:
Quoted text here. Click to load it

Quoted text here. Click to load it


if (h %3 != 0 && Psat == true) {
     Psat = false;
   }

Karl Erik.


Re: Arduino C kode
Den fredag den 17. oktober 2014 23.03.59 UTC+2 skrev Karl Erik Christensen:
Quoted text here. Click to load it
over 3  
Quoted text here. Click to load it




...


jdet?


Mvh.
 Anders

Re: Arduino C kode
Den 18-10-2014 19:59, Anders F skrev:
Quoted text here. Click to load it



Quoted text here. Click to load it









Nej - en lille hobby har man vel lov at have.

Karl Erik.


Re: Arduino C kode


"Karl Erik Christensen"  skrev i meddelelsen  










Nej - en lille hobby har man vel lov at have.

Karl Erik.

Lave hjemmesider ?  ;)



MVH Lars Arup




Re: Arduino C kode
Den 19-10-2014 00:22, Lars Arup skrev:
Quoted text here. Click to load it







Quoted text here. Click to load it

Quoted text here. Click to load it

Hov - glemte:


Skriver du ikke snart et lille brev til mig?

Mvh.
Karl Erik.


Re: Arduino C kode

nsen:
Quoted text here. Click to load it
sen:
Quoted text here. Click to load it
et over 3
Quoted text here. Click to load it



et!)...
Quoted text here. Click to load it


arbejdet?


[...]






Men jeg forstod pointen! ;-)

/A

Re: Arduino C kode
Den 19-10-2014 16:48, Anders F skrev:
Quoted text here. Click to load it

Jeg kom i tvivl om, om jeg forstod den :-)



var det du mente, misforstod jeg meningen.







(for dem der vil sammenligne).

Karl Erik.


Site Timeline