Difference between revisions of "Afficheur TM1638"

From air
Jump to navigation Jump to search
 
Line 4: Line 4:
   
 
==Bibliothèque pour l'Arduino==
 
==Bibliothèque pour l'Arduino==
http://code.google.com/p/tm1638-library
+
* http://code.google.com/p/tm1638-library
Démo http://www.youtube.com/watch?v=s5c2kZjGeVk
+
* Démo http://www.youtube.com/watch?v=s5c2kZjGeVk
  +
* Snippet:
 
 
<pre>
 
<pre>
 
// from http://code.google.com/p/tm1638-library/source/browse/trunk/examples/tm1638_one_module_example/tm1638_one_module_example.pde
 
// from http://code.google.com/p/tm1638-library/source/browse/trunk/examples/tm1638_one_module_example/tm1638_one_module_example.pde

Latest revision as of 11:59, 30 August 2011

Module d'affichage bon marché et chainable. comporte 8 afficheurs segments, 8 LED vert+rouge et 8 boutons.

Achat sur DX http://www.dealextreme.com/p/8x-digital-tube-8x-key-8x-double-color-led-module-81873

Bibliothèque pour l'Arduino

// from http://code.google.com/p/tm1638-library/source/browse/trunk/examples/tm1638_one_module_example/tm1638_one_module_example.pde
#include <TM1638.h>

// define a module on data pin 3, clock pin 2 and strobe pin 4
TM1638 module(3, 2, 4);

void setup() {
  // display a hexadecimal number and set the left 4 dots
  module.setDisplayToHexNumber(0x1234ABCD, 0xF0);
}

void loop() {
  byte keys = module.getButtons();

  // light the first 4 red LEDs and the last 4 green LEDs as the buttons are pressed
  module.setLEDs(((keys & 0xF0) << 8) | (keys & 0xF));
}