<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="cs">
	<id>http://wiki.sps-pi.cz/index.php?action=history&amp;feed=atom&amp;title=Arduino_-_pohybuj%C3%ADc%C3%AD_text%3A_SPS_a_VOS</id>
	<title>Arduino - pohybující text: SPS a VOS - Historie editací</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.sps-pi.cz/index.php?action=history&amp;feed=atom&amp;title=Arduino_-_pohybuj%C3%ADc%C3%AD_text%3A_SPS_a_VOS"/>
	<link rel="alternate" type="text/html" href="http://wiki.sps-pi.cz/index.php?title=Arduino_-_pohybuj%C3%ADc%C3%AD_text:_SPS_a_VOS&amp;action=history"/>
	<updated>2026-05-16T06:30:40Z</updated>
	<subtitle>Historie editací této stránky</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.sps-pi.cz/index.php?title=Arduino_-_pohybuj%C3%ADc%C3%AD_text:_SPS_a_VOS&amp;diff=14979&amp;oldid=prev</id>
		<title>JA: Založena nová stránka: &#039;&#039;&#039;Příklad pro pohybující se text&#039;&#039;&#039;- zde se bude psát SPS A VOS PISEK, nápis lze změnit jednoduchým přepsáním textu const char string, rychlost pohybu textu ...</title>
		<link rel="alternate" type="text/html" href="http://wiki.sps-pi.cz/index.php?title=Arduino_-_pohybuj%C3%ADc%C3%AD_text:_SPS_a_VOS&amp;diff=14979&amp;oldid=prev"/>
		<updated>2012-12-30T10:38:36Z</updated>

		<summary type="html">&lt;p&gt;Založena nová stránka: &amp;#039;&amp;#039;&amp;#039;Příklad pro pohybující se text&amp;#039;&amp;#039;&amp;#039;- zde se bude psát SPS A VOS PISEK, nápis lze změnit jednoduchým přepsáním textu const char string, rychlost pohybu textu ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nová stránka&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Příklad pro pohybující se text&amp;#039;&amp;#039;&amp;#039;- zde se bude psát SPS A VOS PISEK, nápis lze změnit jednoduchým přepsáním textu const char string, rychlost pohybu textu určuje delay&lt;br /&gt;
&amp;lt;source lang&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;TM1638.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MODULES 4&lt;br /&gt;
&lt;br /&gt;
// define a modules&lt;br /&gt;
TM1638 modules[] = {&lt;br /&gt;
	TM1638(3, 2, 4),&lt;br /&gt;
	TM1638(3, 2, 5),&lt;br /&gt;
	TM1638(8, 9, 5),&lt;br /&gt;
	TM1638(8, 9, 4)&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
const char string[] = &amp;quot;      SPS A VOS PISEK        &amp;quot;;&lt;br /&gt;
int base = 0;&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  for (int i = 0; i &amp;lt; MODULES; i++) {&lt;br /&gt;
    const char* pos = string + base + (i * 8);&lt;br /&gt;
&lt;br /&gt;
    if (pos &amp;gt;= string &amp;amp;&amp;amp; pos + 8 &amp;lt; string + sizeof(string)) {&lt;br /&gt;
      modules[i].setDisplayToString(pos);&lt;br /&gt;
    } else {&lt;br /&gt;
      modules[i].clearDisplay();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  base++;&lt;br /&gt;
&lt;br /&gt;
  if (base == sizeof(string) - 8) {&lt;br /&gt;
    base = -MODULES * 8;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  delay(300);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Příklad pro dva Displaye&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;source lang&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;TM1638.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// hello segments for display&lt;br /&gt;
const byte hello[] = {&lt;br /&gt;
  0b00000000, 0b01110110, 0b01111001, 0b00111000, 0b00111000, 0b00111111, 0b00000000, 0b00000000&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// define the first module&lt;br /&gt;
TM1638 module1(3, 2, 4);&lt;br /&gt;
// to chain modules, use the same clk and data - just specify a different strobe pin&lt;br /&gt;
TM1638 module2(3, 2, 5);&lt;br /&gt;
&lt;br /&gt;
unsigned long value = 0L;&lt;br /&gt;
boolean state = true;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // display the hello segments on module 1&lt;br /&gt;
  module1.setDisplay(hello);	&lt;br /&gt;
  // display the hello segments on module 2&lt;br /&gt;
  module2.setDisplay(hello);	&lt;br /&gt;
&lt;br /&gt;
  // light the lower 5 red LEDs and the top 5 green LEDs&lt;br /&gt;
  module1.setLEDs(0b00011111 | 0b11111000 &amp;lt;&amp;lt; 8);&lt;br /&gt;
&lt;br /&gt;
  // light the 3rd red LED&lt;br /&gt;
  module2.setLED(TM1638_COLOR_RED, 3);&lt;br /&gt;
  // light the 5th green LED&lt;br /&gt;
  module2.setLED(TM1638_COLOR_GREEN, 5);&lt;br /&gt;
  // light the 7th red and green LEDs&lt;br /&gt;
  module2.setLED(TM1638_COLOR_RED | TM1638_COLOR_GREEN, 7);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
  byte key1, key2;&lt;br /&gt;
&lt;br /&gt;
  // read the buttons from the first module&lt;br /&gt;
  key1 = module1.getButtons();&lt;br /&gt;
  // read the buttons from the second module&lt;br /&gt;
  key2 = module2.getButtons();&lt;br /&gt;
&lt;br /&gt;
  // both pressed&lt;br /&gt;
  if (key1 != 0 &amp;amp;&amp;amp; key2 != 0) {&lt;br /&gt;
    value = 0;&lt;br /&gt;
&lt;br /&gt;
	// set the display to 0 on both modules if they have buttons pressed simultaneously&lt;br /&gt;
    module1.setDisplayToHexNumber(value, 0b10101010);&lt;br /&gt;
    module2.setDisplayToDecNumber(value, 0b01010101);&lt;br /&gt;
  } else {&lt;br /&gt;
	// check the first module buttons&lt;br /&gt;
    if (key1 != 0) {&lt;br /&gt;
      // show the pressed buttons of the first module on its display&lt;br /&gt;
      module2.setDisplayToBinNumber(key1, 0);&lt;br /&gt;
      // and on the LEDs&lt;br /&gt;
      module1.setLEDs(key1);&lt;br /&gt;
&lt;br /&gt;
	  // check to see if it&amp;#039;s the last button pressed&lt;br /&gt;
      if (key1 &amp;amp; 128) {&lt;br /&gt;
      	// toggle the display state on/off&lt;br /&gt;
        state = !state;&lt;br /&gt;
        delay(200); // just wait for button up&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
	  // set the intensity and display state&lt;br /&gt;
      module1.setupDisplay(state, key1 &amp;gt;&amp;gt; 1);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
	// check the second module buttons&lt;br /&gt;
    if (key2 != 0) {&lt;br /&gt;
      // just add it to the display value&lt;br /&gt;
      value += key2;&lt;br /&gt;
&lt;br /&gt;
      // display it as an hexadecimal on the first module&lt;br /&gt;
      module1.setDisplayToHexNumber(value, 0b10101010);&lt;br /&gt;
      // and as a decimal on the second module&lt;br /&gt;
      module2.setDisplayToDecNumber(value, 0b01010101);&lt;br /&gt;
&lt;br /&gt;
	  // light the LEDs&lt;br /&gt;
      module2.setLEDs(key2 &amp;lt;&amp;lt; 8);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JA</name></author>
	</entry>
</feed>