Afficheur TM1638

From air
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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));
}