<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=47&amp;t=6035&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-02-17T09:59:04+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=47&amp;t=6035&amp;mode</id>
<entry>
<author><name><![CDATA[tOmki]]></name></author>
<updated>2014-02-17T09:59:04+01:00</updated>
<published>2014-02-17T09:59:04+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70769#p70769</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70769#p70769"/>
<title type="html"><![CDATA[Re: Po założeniu Ethernet shield nie działa kod]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70769#p70769"><![CDATA[
Ta zworka nie jest zlutowana.<br /><br />Dla sprawdzenia wrzuciłem prosty kod z odczytem temperatury z DHT11 (PD2) z wyświetlaniem danych na LCD po I2C - wszystko działa z założonym ethernet shield'em.<br /><br />Wpadłem jeszcze na jeden pomysł , dlaczego to nie działa.<br />W sumie COM zwraca mi tylko &quot;ookDecoder&quot; czyli kod jest wykonywany, ale za słabe napięcie zmniejsza czułość odbiornika i nic nie wyłapuje.<br />Kupię MB-102 i osobno będę zasilał odbiornik.<br /><br />ps. można jednocześnie zasilać arduino poprzez USB i DC ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2087">tOmki</a> — 17 lut 2014, o 09:59</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[xor]]></name></author>
<updated>2014-02-17T09:42:03+01:00</updated>
<published>2014-02-17T09:42:03+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70767#p70767</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70767#p70767"/>
<title type="html"><![CDATA[Re: Po założeniu Ethernet shield nie działa kod]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70767#p70767"><![CDATA[
<div class="quotetitle"><a href="http://arduino.cc/en/Main/ArduinoEthernetShield#.UwHJL87ldKQ"  class="postlink">http://arduino.cc/en/Main/ArduinoEthernetShield#.UwHJL87ldKQ</a> napisał(a):</div><div class="quotecontent"><br />&quot;The solder jumper marked &quot;INT&quot; can be connected to allow the Arduino board to receive interrupt-driven notification of events from the W5100, but this is not supported by the Ethernet library. The jumper connects the INT pin of the W5100 to digital pin 2 of the Arduino. &quot;<br /></div><br /><br />Sprawdź czy masz to zlutowane<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1774">xor</a> — 17 lut 2014, o 09:42</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[tOmki]]></name></author>
<updated>2014-02-16T23:34:47+01:00</updated>
<published>2014-02-16T23:34:47+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70743#p70743</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70743#p70743"/>
<title type="html"><![CDATA[Po założeniu Ethernet shield nie działa kod]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=6035&amp;p=70743#p70743"><![CDATA[
Mam problem z ethernet shield'em, po założeniu go na arduino uno r3 nie działa mi kod - odczyt temperatury z nadajników Oregon Scientific. W samym kodzie nie żadnych odniesień do ethernet shield'a.Bez ethernet shield,a kod działa. <br /><br />Odbiornik podłączony do PD2 lub PD3. Nie jest to raczej problem sprzętowy bo inny kod, który używa PD2 bez problemu mi działa.<br />Możliwe że przerywania się &quot;gryzą&quot; ? Albo coś innego.<br /><br />Kod wygląda tak:<br />[syntax=cpp]// Oregon V2 decoder modfied - Olivier Lebrun<br />// Oregon V2 decoder added - Dominique Pierre<br />// New code to decode OOK signals from weather sensors, etc.<br />// 2010-04-11 &lt;jcw@equi4.com&gt; http://opensource.org/licenses/mit-license.php<br />// $Id: ookDecoder.pde 5331 2010-04-17 10:45:17Z jcw $<br /> <br />class DecodeOOK {<br />protected:<br />    byte total_bits, bits, flip, state, pos, data&#91;25&#93;;<br /> <br />    virtual char decode (word width) =0;<br /> <br />public:<br /> <br />    enum { UNKNOWN, T0, T1, T2, T3, OK, DONE };<br /> <br />    DecodeOOK () { resetDecoder(); }<br /> <br />    bool nextPulse (word width) {<br />        if (state != DONE)<br /> <br />            switch (decode(width)) {<br />                case -1: resetDecoder(); break;<br />                case 1:  done(); break;<br />            }<br />        return isDone();<br />    }<br /> <br />    bool isDone () const { return state == DONE; }<br /> <br />    const byte* getData (byte&amp; count) const {<br />        count = pos;<br />        return data;<br />    }<br /> <br />    void resetDecoder () {<br />        total_bits = bits = pos = flip = 0;<br />        state = UNKNOWN;<br />    }<br /> <br />    // add one bit to the packet data buffer<br /> <br />    virtual void gotBit (char value) {<br />        total_bits++;<br />        byte *ptr = data + pos;<br />        *ptr = (*ptr &gt;&gt; 1) | (value &lt;&lt; 7);<br /> <br />        if (++bits &gt;= 8) {<br />            bits = 0;<br />            if (++pos &gt;= sizeof data) {<br />                resetDecoder();<br />                return;<br />            }<br />        }<br />        state = OK;<br />    }<br /> <br />    // store a bit using Manchester encoding<br />    void manchester (char value) {<br />        flip ^= value; // manchester code, long pulse flips the bit<br />        gotBit(flip);<br />    }<br /> <br />    // move bits to the front so that all the bits are aligned to the end<br />    void alignTail (byte max =0) {<br />        // align bits<br />        if (bits != 0) {<br />            data&#91;pos&#93; &gt;&gt;= 8 - bits;<br />            for (byte i = 0; i &lt; pos; ++i)<br />                data&#91;i&#93; = (data&#91;i&#93; &gt;&gt; bits) | (data&#91;i+1&#93; &lt;&lt; (8 - bits));<br />            bits = 0;<br />        }<br />        // optionally shift bytes down if there are too many of 'em<br />        if (max &gt; 0 &amp;&amp; pos &gt; max) {<br />            byte n = pos - max;<br />            pos = max;<br />            for (byte i = 0; i &lt; pos; ++i)<br />                data&#91;i&#93; = data&#91;i+n&#93;;<br />        }<br />    }<br /> <br />    void reverseBits () {<br />        for (byte i = 0; i &lt; pos; ++i) {<br />            byte b = data&#91;i&#93;;<br />            for (byte j = 0; j &lt; 8; ++j) {<br />                data&#91;i&#93; = (data&#91;i&#93; &lt;&lt; 1) | (b &amp; 1);<br />                b &gt;&gt;= 1;<br />            }<br />        }<br />    }<br /> <br />    void reverseNibbles () {<br />        for (byte i = 0; i &lt; pos; ++i)<br />            data&#91;i&#93; = (data&#91;i&#93; &lt;&lt; 4) | (data&#91;i&#93; &gt;&gt; 4);<br />    }<br /> <br />    void done () {<br />        while (bits)<br />            gotBit(0); // padding<br />        state = DONE;<br />    }<br />};<br /> <br />class OregonDecoderV2 : public DecodeOOK {<br />  public:   <br /> <br />    OregonDecoderV2() {}<br /> <br />    // add one bit to the packet data buffer<br />    virtual void gotBit (char value) {<br />        if(!(total_bits &amp; 0x01))<br />        {<br />            data&#91;pos&#93; = (data&#91;pos&#93; &gt;&gt; 1) | (value ? 0x80 : 00);<br />        }<br />        total_bits++;<br />        pos = total_bits &gt;&gt; 4;<br />        if (pos &gt;= sizeof data) {<br />            Serial.println(&quot;sizeof data&quot;);<br />            resetDecoder();<br />            return;<br />        }<br />        state = OK;<br />    }<br /> <br />    virtual char decode (word width) {<br />       if (200 &lt;= width &amp;&amp; width &lt; 1200) {<br />            //Serial.println(width);<br />            byte w = width &gt;= 700;<br /> <br />            switch (state) {<br />                case UNKNOWN:<br />                    if (w != 0) {<br />                        // Long pulse<br />                        ++flip;<br />                    } else if (w == 0 &amp;&amp; 24 &lt;= flip) {<br />                        // Short pulse, start bit<br />                        flip = 0;<br />                        state = T0;<br />                    } else {<br />                        // Reset decoder<br />                        return -1;<br />                    }<br />                    break;<br />                case OK:<br />                    if (w == 0) {<br />                        // Short pulse<br />                        state = T0;<br />                    } else {<br />                        // Long pulse<br />                        manchester(1);<br />                    }<br />                    break;<br />                case T0:<br />                    if (w == 0) {<br />                      // Second short pulse<br />                        manchester(0);<br />                    } else {<br />                        // Reset decoder<br />                        return -1;<br />                    }<br />                    break;<br />              }<br />        } else if (width &gt;= 2500  &amp;&amp; pos &gt;= 8) {<br />            return 1;<br />        } else {<br />            return -1;<br />        }<br />        return 0;<br />    }<br />};<br /> <br />OregonDecoderV2 orscV2;<br /> <br />volatile word pulse;<br /> <br />void ext_int_1(void)<br />{<br />    static word last;<br />    // determine the pulse length in microseconds, for either polarity<br />    pulse = micros() - last;<br />    last += pulse;<br />}<br /><br />float temperature(const byte* data)<br />{<br />    int sign = (data&#91;6&#93;&amp;0x8) ? -1 : 1;<br />    float temp = ((data&#91;5&#93;&amp;0xF0) &gt;&gt; 4)*10 + (data&#91;5&#93;&amp;0xF) + (float)(((data&#91;4&#93;&amp;0xF0) &gt;&gt; 4) / 10.0);<br />    return sign * temp;<br />}<br /> <br />byte humidity(const byte* data)<br />{<br />    return (data&#91;7&#93;&amp;0xF) * 10 + ((data&#91;6&#93;&amp;0xF0) &gt;&gt; 4);<br />}<br /> <br />// Ne retourne qu'un apercu de l'etat de la baterie : 10 = faible<br />byte battery(const byte* data)<br />{<br />    return (data&#91;4&#93; &amp; 0x4) ? 10 : 90;<br />}<br /> <br />byte channel(const byte* data)<br />{<br />    byte channel;<br />    switch (data&#91;2&#93;)<br />    {<br />        case 0x10:<br />            channel = 1;<br />            break;<br />        case 0x20:<br />            channel = 2;<br />            break;<br />        case 0x40:<br />            channel = 3;<br />            break;<br />     }<br /> <br />     return channel;<br />}<br /> <br />void reportSerial (const char* s, class DecodeOOK&amp; decoder)<br />{<br />    byte pos;<br />    const byte* data = decoder.getData(pos);<br />    Serial.print(s);<br />    Serial.print(' ');<br />    for (byte i = 0; i &lt; pos; ++i) {<br />        Serial.print(data&#91;i&#93; &gt;&gt; 4, HEX);<br />        Serial.print(data&#91;i&#93; &amp; 0x0F, HEX);<br />    }<br /> <br />    // Outside/Water Temp : THN132N,...<br />    if(data&#91;0&#93; == 0xEA &amp;&amp; data&#91;1&#93; == 0x4C)<br />    {<br />       Serial.print(&quot;&#91;THN132N,...&#93; Id:&quot;);<br />       Serial.print(data&#91;3&#93;, HEX);<br />       Serial.print(&quot; ,Channel:&quot;);<br />       Serial.print(channel(data));<br />       Serial.print(&quot; ,temp:&quot;);<br />       Serial.print(temperature(data));<br />       Serial.print(&quot; ,bat:&quot;);<br />       Serial.print(battery(data));<br />       Serial.println();<br />    }<br />    // Inside Temp-Hygro : THGR228N,...<br />    else if(data&#91;0&#93; == 0x1A &amp;&amp; data&#91;1&#93; == 0x2D)<br />    {<br />       Serial.print(&quot;&#91;THGR228N,...&#93; Id:&quot;);<br />       Serial.print(data&#91;3&#93;, HEX);<br />       Serial.print(&quot; ,Channel:&quot;);<br />       Serial.print(channel(data));<br />       Serial.print(&quot; ,temp:&quot;);<br />       Serial.print(temperature(data));<br />       Serial.print(&quot; ,hum:&quot;);<br />       Serial.print(humidity(data));<br />       Serial.print(&quot; ,bat:&quot;);<br />       Serial.print(battery(data));<br />       Serial.println();<br />    }<br /> <br />    decoder.resetDecoder();<br />}<br /> <br />void setup ()<br />{<br />    Serial.begin(115200);<br />    Serial.println(&quot;\n&#91;ookDecoder&#93;&quot;);<br />    attachInterrupt(0, ext_int_1, CHANGE);<br />    <br />    //oryginalne<br />    //DDRE  &amp;= ~_BV(PE5); //input with pull-up<br />    //PORTE &amp;= ~_BV(PE5);<br />    <br />    //DDRD  &amp;= ~_BV(2); //input with pull-up<br />    //PORTD &amp;= ~_BV(2);<br />}<br /> <br />void loop () {<br />    static int i = 0;<br />    cli();<br />    word p = pulse;<br /> <br />    pulse = 0;<br />    sei();<br /> <br />    if (p != 0)<br />    {<br />        if (orscV2.nextPulse(p))<br />            reportSerial(&quot;OSV2&quot;, orscV2); <br />    }<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2087">tOmki</a> — 16 lut 2014, o 23:34</p><hr />
]]></content>
</entry>
</feed>