<?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=4&amp;t=17143&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2016-12-26T16:50:16+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=17143&amp;mode</id>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T16:50:16+01:00</updated>
<published>2016-12-26T16:50:16+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178265#p178265</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178265#p178265"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178265#p178265"><![CDATA[
dzięki działa super biorę się za pwm teraz <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /><br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 1 minucie ]</span></strong><br /><br />a co zrobić jeśli chcem naprzykład żeby dioda świeciała jak trzyamam ten przycisk ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 16:50</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-12-26T16:44:35+01:00</updated>
<published>2016-12-26T16:44:35+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178262#p178262</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178262#p178262"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178262#p178262"><![CDATA[
Zrób tak:<br />[syntax=c]int main()<br />{<br />USART_init();<br />sei();<br />while(1)<br />{<br /><br />//send_usart(USART_Receive());<br /><br />char znak = USART_Receive();<br /><br />send_usart(znak);<br /><br />if (znak == '1') PORTC |= (1&lt;&lt;PC5);<br />if (znak == '2') PORTC &amp;= ~(1&lt;&lt;PC5);<br /><br />_delay_ms(100);<br />}<br /><br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 26 gru 2016, o 16:44</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T16:35:59+01:00</updated>
<published>2016-12-26T16:35:59+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178260#p178260</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178260#p178260"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178260#p178260"><![CDATA[
Oto cały kod programu może nie najlepszy ale programuje dopiero od 4dni  <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /> <br />[syntax=c]#include &lt;avr/io.h&gt;<br />    #include &lt;util/delay.h&gt;<br />    #include &lt;avr/interrupt.h&gt;<br />    #include &lt;stdint.h&gt;<br /><br />    void USART_init()<br />    {<br />            #define UART_BAUD 9600<br />            #define BAUD_PRESCALE ((F_CPU+UART_BAUD*8UL) / (16UL*UART_BAUD)-1)<br /><br />            UBRRH = (BAUD_PRESCALE &gt;&gt; 8);<br />            UBRRL = BAUD_PRESCALE;<br />            DDRC |= (1&lt;&lt;PC5); //ustawienie rejestru do diody<br />            UCSRC = (1&lt;&lt;URSEL) | (1&lt;&lt;UCSZ1) | (3&lt;&lt;UCSZ0);<br />            UCSRB = (1&lt;&lt;TXEN) | (1&lt;&lt;RXEN) | (1&lt;&lt;TXCIE);<br />    }<br />           uint8_t USART_Receive()<br />        {<br />    while ( !(UCSRA &amp; (1&lt;&lt;RXC)) );<br />             return UDR;<br /><br />    }<br />           void send_usart(uint8_t byte)<br />           {<br />           while (!(UCSRA &amp; _BV(UDRE)));<br />           UDR=byte;<br />           }<br />           int main()<br />           {<br />           USART_init();<br />                       sei();<br />                       while(1)<br />                       {<br /><br />                       send_usart(USART_Receive());<br /><br />                       char znak = USART_Receive();<br /><br />                              if (znak == '1') PORTC |= (1&lt;&lt;PC5);<br />                              if (znak == '2') PORTC &amp;= ~(1&lt;&lt;PC5);<br /><br />                              _delay_ms(100);<br />                        }<br /><br />                       }[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 16:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-12-26T16:32:33+01:00</updated>
<published>2016-12-26T16:32:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178259#p178259</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178259#p178259"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178259#p178259"><![CDATA[
Pokaż twój main.c<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 26 gru 2016, o 16:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T16:33:13+01:00</updated>
<published>2016-12-26T16:29:03+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178258#p178258</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178258#p178258"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178258#p178258"><![CDATA[
wpisuje w konsole 1 i nic wpisuje '1'  i też nic niemam pojęcia co może być nie tak<br />dodam że wysyłam to wszystko w kodzie ASCII<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 16:29</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Daro69]]></name></author>
<updated>2016-12-26T16:22:00+01:00</updated>
<published>2016-12-26T16:22:00+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178257#p178257</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178257#p178257"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178257#p178257"><![CDATA[
a wysyłasz znak '1' czy wartość 1 ?<br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 4 minutach ]</span></strong><br /><br />i czy ogólnie dioda działa, - np. czy masz [syntax=c]DDRC |=(1&lt;&lt;PC5);[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11549">Daro69</a> — 26 gru 2016, o 16:22</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T16:19:01+01:00</updated>
<published>2016-12-26T16:19:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178256#p178256</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178256#p178256"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178256#p178256"><![CDATA[
właśnie nic z tego mi niedziała jak wysyłam tą liczbę przez konsolę to nic sie niedzieje a połączenie jest 100% dobre bo sobie echo zostawiłem by wiedzieć czy wogóle moja wiadomość do atmegi8 dociera<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 16:19</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Daro69]]></name></author>
<updated>2016-12-26T16:06:49+01:00</updated>
<published>2016-12-26T16:06:49+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178255#p178255</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178255#p178255"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178255#p178255"><![CDATA[
przekopiowałem małe niedociągnięcie.  <img src="https://forum.atnel.pl/images/smilies/icon_e_confused.gif" alt=":?" title="Boi się" /> <br /><div class="quotetitle">Daro69 napisał(a):</div><div class="quotecontent"><br />[syntax=c]if ( USART_Receive == '1' ) {  //jeżeli USART_Receive ma wartość znaku cyfra'1' czyli liczba/wartość(49)(może przeciaz nie mieć.)<br />        PORTC |= (1&lt;&lt;PC5);<br />}[/syntax]<br /></div><br />USART_Receive to funkcja  <img src="https://forum.atnel.pl/images/smilies/icon_rolleyes.gif" alt=":roll:" title="Udaje, że to nie on" />  USART_Receive<strong>()</strong>;<br />a zapis &quot;USART_Receive&quot; to wskaźnik na jej adres.  <img src="https://forum.atnel.pl/images/smilies/icon_rolleyes.gif" alt=":roll:" title="Udaje, że to nie on" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11549">Daro69</a> — 26 gru 2016, o 16:06</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-12-26T15:52:30+01:00</updated>
<published>2016-12-26T15:52:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178254#p178254</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178254#p178254"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178254#p178254"><![CDATA[
Spróbuj tak:<br />[syntax=c]while(1) {<br />char znak = USART_Receive();<br /><br />if (znak == '1') PORTC |= (1&lt;&lt;PC5);<br />if (znak == '2') PORTC &amp;= ~(1&lt;&lt;PC5);<br /><br />_delay_ms(100);<br /><br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 26 gru 2016, o 15:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T15:47:12+01:00</updated>
<published>2016-12-26T15:47:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178253#p178253</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178253#p178253"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178253#p178253"><![CDATA[
Oto ten kod [syntax=c]uint8_t USART_Receive()<br />        {<br />    while ( !(UCSRA &amp; (1&lt;&lt;RXC)) );  <br />             return UDR;[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 15:47</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Daro69]]></name></author>
<updated>2016-12-26T15:42:02+01:00</updated>
<published>2016-12-26T15:42:02+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178252#p178252</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178252#p178252"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178252#p178252"><![CDATA[
<div class="quotetitle">Marcin K napisał(a):</div><div class="quotecontent"><br />[syntax=c]if ( USART_Receive = 1 ); PORTC |= (1&lt;&lt;PC5); // teraz USART_Receive ma wartość 1, jest spełnione.<br /><br />if ( USART_Receive = 2 ); PORTC &amp;= (1&lt;&lt;PC5); // teraz USART_Receive ma wartość 2, jest spełnione.[/syntax]<br /></div><br />Tak jak <strong>anshar</strong> sugeruje:<br />[syntax=c]if ( USART_Receive == '1' ) {  //jeżeli USART_Receive ma wartość znaku cyfra'1' czyli liczba/wartość(49)(może przeciaz nie mieć.)<br />        PORTC |= (1&lt;&lt;PC5);<br />}[/syntax]<br />Chyba że i ja coś źle zrozumiałem.  <img src="https://forum.atnel.pl/images/smilies/icon_e_confused.gif" alt=":?" title="Boi się" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11549">Daro69</a> — 26 gru 2016, o 15:42</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-12-26T15:40:18+01:00</updated>
<published>2016-12-26T15:40:18+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178251#p178251</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178251#p178251"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178251#p178251"><![CDATA[
A jak wygląda twoja funkcja USART_Receive()?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 26 gru 2016, o 15:40</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T15:29:03+01:00</updated>
<published>2016-12-26T15:29:03+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178250#p178250</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178250#p178250"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178250#p178250"><![CDATA[
Ale ja ma bluetooth Terminal i łacze się z atmeg8 i wysłam np cyfrę 1 to chcę załączyć nią diodę itp<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 15:29</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[anshar]]></name></author>
<updated>2016-12-26T15:39:35+01:00</updated>
<published>2016-12-26T15:14:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178249#p178249</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178249#p178249"/>
<title type="html"><![CDATA[Re: Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178249#p178249"><![CDATA[
Powinno być tak:<br />[syntax=c]if (USART_Receive() == '1') {<br />PORTC |= (1&lt;&lt;PC5);<br />}<br />if (USART_Receive() == '2') {<br />PORTC &amp;= (1&lt;&lt;PC5);<br />}[/syntax]<br /><br />A jeśli po warkunku występuje tylko jedna linijka to można tak:<br />[syntax=c]if (USART_Receive() == '1') PORTC |= (1&lt;&lt;PC5);<br /><br />if (USART_Receive() == '2') PORTC &amp;= (1&lt;&lt;PC5);[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=7157">anshar</a> — 26 gru 2016, o 15:14</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Marcin K]]></name></author>
<updated>2016-12-26T14:50:44+01:00</updated>
<published>2016-12-26T14:50:44+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178248#p178248</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178248#p178248"/>
<title type="html"><![CDATA[Problem ze Sterowaniem bluetooth]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17143&amp;p=178248#p178248"><![CDATA[
Witam udało mi się w końcu połączyć atmeg8 ze smartfonem ale chciałbym sterować np diodą led lecz niewiem jak się zato zabrać próbowałem tak to zrealizować [syntax=c]if (USART_Receive= 1);<br />                       PORTC |= (1&lt;&lt;PC5);<br />                       if (USART_Receive= 2);<br />                       PORTC &amp;= (1&lt;&lt;PC5);[/syntax]<br />jeśli ktoś może mi podpowiedzieć jak mogę to zrobić będę wdzięczny<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15920">Marcin K</a> — 26 gru 2016, o 14:50</p><hr />
]]></content>
</entry>
</feed>