<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Arduino mehrere Datein]]></title><description><![CDATA[<p>Hallo, ich hoffe hier keinen DoppelThread aufgemacht zu haben.<br />
Ich habe das Problem, dass ich bei einem kleinen Arduino Project mehrere Dateien verwende. In einer zusätzlichen Datei habe ich einen Timer programmiert, der wird aber anscheinend von der MainLoop nicht gefunden, es passiert nämlich nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":-("
      alt="😞"
    /></p>
<p>Die Funktion die nicht gefunden wird ist die <strong>MyTon</strong><br />
Kopiere ich die Funktion aber vor die MainLoop funktionierts, deshlab gehe ich davon aus, dass die Funktion nicht gefunden wird. Hier meine Dateien:</p>
<p><strong>SechsLEDs</strong></p>
<pre><code>#include &quot;Functions.h&quot;   

#include &quot;SechsLEDs.h&quot;

// variables will change:
char buttonState = FALSE;         
int ActiveLed = LED_PIN_START;

void setup() 
{
  int i = 0;

  // initialize the LED pin as an output:
  for (i = LED_PIN_START; i &lt;= LED_PIN_END; i++)
    pinMode(i, OUTPUT);

  // initialize the pushbutton pin as an input:
  pinMode(BUTTON_PIN, INPUT);
}

char buttonStateBuff = 0;

void loop() 
{
  int i = 0;

  //initialize TimeStruct for Button
  TIMESTRUCT *PrellTime = NULL;  
  PrellTime = (TIMESTRUCT *) malloc(sizeof(TIMESTRUCT));  
  PrellTime-&gt;PresetTime = PRELL_TIME; 

  while(1)
  {
    // read the state of the pushbutton value:
    PrellTime-&gt;Enable = digitalRead(BUTTON_PIN);    
    buttonState = MyTon(PrellTime);

    if (buttonState == TRUE &amp;&amp; !buttonStateBuff) 
    {
      if(ActiveLed &gt; LED_PIN_END)
      {
        ActiveLed = LED_PIN_START;

        for (i = LED_PIN_START; i &lt;= LED_PIN_END; i++)
          digitalWrite(i, LOW);  
      }
      else
      {
        digitalWrite(ActiveLed, HIGH);
        ActiveLed++;
      }
  }

  buttonStateBuff = buttonState;
  }
}
</code></pre>
<p><strong>Functions.c</strong></p>
<pre><code>#include &quot;Functions.h&quot;

//ToDO Überlauf von Zeit abfangen
char MyTon(TIMESTRUCT *pStruct)
{
  char frc = FALSE;

  if(!pStruct-&gt;EnableBuff)
  {
    pStruct-&gt;StartTime = millis();  
  }

  if((millis() - pStruct-&gt;StartTime) &gt; pStruct-&gt;PresetTime)
    frc = TRUE;

  pStruct-&gt;EnableBuff = pStruct-&gt;Enable;

  return frc;
}
</code></pre>
<p><strong>Functions.h</strong></p>
<pre><code>#ifndef FUNCTIONS_H
#define FUNCTIONS_H

    #define TRUE  1
    #define FALSE 0

    typedef struct 
    {
      unsigned long StartTime;
      unsigned long PresetTime;      
      //unsigned long Accu;
      char Enable;
      char EnableBuff;
    }TIMESTRUCT;

    #ifdef __cplusplus
      extern &quot;C&quot; {
    #endif

      extern char MyTon(TIMESTRUCT *pStruct);

    #ifdef __cplusplus
      }
    #endif

#endif
</code></pre>
<p><strong>SechsLEDs.h</strong></p>
<pre><code>#ifndef SECHSLEDS_H
#define SECHSLEDS_H

  const int BUTTON_PIN          = 3;     
  const int LED_PIN_START       = 8;  
  const int LED_PIN_END         = 13;  
  const unsigned int PRELL_TIME = 50;

#endif
</code></pre>
<p>Vielen Dank für eure Hilfe. Es handelt sich hierbei nicht um eine Hausaufgabe oder so etwas, ich wollte einfach nur mal Anfangen mit so einem Teil etwas herumzuspielen. Ich habe schon einiges gelesen bezüglich des EXTERn &quot;C&quot;, bekomme das aber irgendwie nicht hin.</p>
<p>Nochmal vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/338919/arduino-mehrere-datein</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 03:19:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/338919.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Jul 2016 07:42:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Arduino mehrere Datein on Thu, 21 Jul 2016 07:42:33 GMT]]></title><description><![CDATA[<p>Hallo, ich hoffe hier keinen DoppelThread aufgemacht zu haben.<br />
Ich habe das Problem, dass ich bei einem kleinen Arduino Project mehrere Dateien verwende. In einer zusätzlichen Datei habe ich einen Timer programmiert, der wird aber anscheinend von der MainLoop nicht gefunden, es passiert nämlich nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":-("
      alt="😞"
    /></p>
<p>Die Funktion die nicht gefunden wird ist die <strong>MyTon</strong><br />
Kopiere ich die Funktion aber vor die MainLoop funktionierts, deshlab gehe ich davon aus, dass die Funktion nicht gefunden wird. Hier meine Dateien:</p>
<p><strong>SechsLEDs</strong></p>
<pre><code>#include &quot;Functions.h&quot;   

#include &quot;SechsLEDs.h&quot;

// variables will change:
char buttonState = FALSE;         
int ActiveLed = LED_PIN_START;

void setup() 
{
  int i = 0;

  // initialize the LED pin as an output:
  for (i = LED_PIN_START; i &lt;= LED_PIN_END; i++)
    pinMode(i, OUTPUT);

  // initialize the pushbutton pin as an input:
  pinMode(BUTTON_PIN, INPUT);
}

char buttonStateBuff = 0;

void loop() 
{
  int i = 0;

  //initialize TimeStruct for Button
  TIMESTRUCT *PrellTime = NULL;  
  PrellTime = (TIMESTRUCT *) malloc(sizeof(TIMESTRUCT));  
  PrellTime-&gt;PresetTime = PRELL_TIME; 

  while(1)
  {
    // read the state of the pushbutton value:
    PrellTime-&gt;Enable = digitalRead(BUTTON_PIN);    
    buttonState = MyTon(PrellTime);

    if (buttonState == TRUE &amp;&amp; !buttonStateBuff) 
    {
      if(ActiveLed &gt; LED_PIN_END)
      {
        ActiveLed = LED_PIN_START;

        for (i = LED_PIN_START; i &lt;= LED_PIN_END; i++)
          digitalWrite(i, LOW);  
      }
      else
      {
        digitalWrite(ActiveLed, HIGH);
        ActiveLed++;
      }
  }

  buttonStateBuff = buttonState;
  }
}
</code></pre>
<p><strong>Functions.c</strong></p>
<pre><code>#include &quot;Functions.h&quot;

//ToDO Überlauf von Zeit abfangen
char MyTon(TIMESTRUCT *pStruct)
{
  char frc = FALSE;

  if(!pStruct-&gt;EnableBuff)
  {
    pStruct-&gt;StartTime = millis();  
  }

  if((millis() - pStruct-&gt;StartTime) &gt; pStruct-&gt;PresetTime)
    frc = TRUE;

  pStruct-&gt;EnableBuff = pStruct-&gt;Enable;

  return frc;
}
</code></pre>
<p><strong>Functions.h</strong></p>
<pre><code>#ifndef FUNCTIONS_H
#define FUNCTIONS_H

    #define TRUE  1
    #define FALSE 0

    typedef struct 
    {
      unsigned long StartTime;
      unsigned long PresetTime;      
      //unsigned long Accu;
      char Enable;
      char EnableBuff;
    }TIMESTRUCT;

    #ifdef __cplusplus
      extern &quot;C&quot; {
    #endif

      extern char MyTon(TIMESTRUCT *pStruct);

    #ifdef __cplusplus
      }
    #endif

#endif
</code></pre>
<p><strong>SechsLEDs.h</strong></p>
<pre><code>#ifndef SECHSLEDS_H
#define SECHSLEDS_H

  const int BUTTON_PIN          = 3;     
  const int LED_PIN_START       = 8;  
  const int LED_PIN_END         = 13;  
  const unsigned int PRELL_TIME = 50;

#endif
</code></pre>
<p>Vielen Dank für eure Hilfe. Es handelt sich hierbei nicht um eine Hausaufgabe oder so etwas, ich wollte einfach nur mal Anfangen mit so einem Teil etwas herumzuspielen. Ich habe schon einiges gelesen bezüglich des EXTERn &quot;C&quot;, bekomme das aber irgendwie nicht hin.</p>
<p>Nochmal vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502923</guid><dc:creator><![CDATA[HerrRatlose]]></dc:creator><pubDate>Thu, 21 Jul 2016 07:42:33 GMT</pubDate></item><item><title><![CDATA[Reply to Arduino mehrere Datein on Thu, 21 Jul 2016 09:01:24 GMT]]></title><description><![CDATA[<p>Du könntest versuchen, vor die Definition von MyTon noch ein extern C davorsetzen, wie du es bei der Deklaration getan hast. Kompilierst und linkst du auch beide Dateien? extern C benötigst du nur, mischt du C und C++-Kompilate.<br />
Ansonsten solltest du dynamisch reservierten Speicher auch freigeben und unerwartet ändernde Variablen als volatile markieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502926</guid><dc:creator><![CDATA[Techel]]></dc:creator><pubDate>Thu, 21 Jul 2016 09:01:24 GMT</pubDate></item><item><title><![CDATA[Reply to Arduino mehrere Datein on Thu, 21 Jul 2016 09:31:14 GMT]]></title><description><![CDATA[<p>Ich habe jetzt das Arduino Plugin für Visual Studio runtergeladen. Dann probiere ich das heute Abend noch einmal. Wo kann ich dann eventuell sehen, ob alle angelegten Files mitkompiliert werden??? Ich habe die Dateien angelegt, aber sonst nichts angegeben. Nach dem kompilieren bekam ich keinen Fehler und gehe davon aus das alles ok ist.</p>
<p>Danke für die schnelle Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2502930</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2502930</guid><dc:creator><![CDATA[HerrRatlose]]></dc:creator><pubDate>Thu, 21 Jul 2016 09:31:14 GMT</pubDate></item></channel></rss>